You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
Active Session List (Logged in users + Run-As users)
package mainimport ("fmt" wapi"github.com/iamacarpet/go-win64api")funcmain(){// This check runs best as NT AUTHORITY\SYSTEM//// Running as a normal or even elevated user,// we can't properly detect who is an admin or not.//// This is because we require TOKEN_DUPLICATE permission,// which we don't seem to have otherwise (Win10).users,err:=wapi.ListLoggedInUsers()iferr!=nil {fmt.Printf("Error fetching user session list.\r\n")return }fmt.Printf("Users currently logged in (Admin check doesn't work for AD Accounts):\r\n")for_,u:=rangeusers {fmt.Printf("\t%-50s - Local User: %-5t - Local Admin: %t\r\n",u.FullUser(),u.LocalUser,u.LocalAdmin) }}
s:=true// User can't change passwords:=false// User can change passwordok,err:=wapi.UserDisablePasswordChange(username,s)
Change Attribute - Password Never Expires
s:=true// Password never expires.s:=false// Enable password expiry.ok,err:=wapi.UserPasswordNoExpires(username,s)
Forced Password Change
ok,err:=wapi.ChangePassword(username,newpassword)
Windows Firewall - Add Inbound Rule
added,err:=wapi.FirewallRuleCreate("App Rule Name","App Rule Long Description.","My Rule Group","%systemDrive%\\path\\to\\my.exe","port number as string",wapi.NET_FW_IP_PROTOCOL_TCP,)