Quick commands
Local User Management
Add Microsoft Entra ID userUser to local groupAdministrator AdministratorsGroup
$UPN = "<yourupn>"
Add-LocalGroupMember -SID 'S-1-5-32-544' -Member "AzureAD\$UPN+
Add Entra ID User to local Remote Desktop Users Group
$UPN = "<yourupn>"
Add-LocalGroupMember -SID "S-1-5-32-555" -Member "AzureAD\$UPN"
Remove Password for local User account
Set-LocalUser -name "<yourlocalusername>" -Password ([securestring]::new())
KMS
Write KMS Server
Invoke-Expression "$env:windir\system32\cscript.exe $env:windir\system32\slmgr.vbs /skms kms.core.windows.net:1688"
Read system information
Get serial number by cmd
wmic bios get serialnumber
Read user information
Get AD group membership of user
$UPN = "<yourupn>"
Add-LocalGroupMember -SID 'S-1-5-32-544' -Member "AzureAD\$UPN+
$UPN = "<yourupn>"
Add-LocalGroupMember -SID "S-1-5-32-555" -Member "AzureAD\$UPN"
Set-LocalUser -name "<yourlocalusername>" -Password ([securestring]::new())
Invoke-Expression "$env:windir\system32\cscript.exe $env:windir\system32\slmgr.vbs /skms kms.core.windows.net:1688"
wmic bios get serialnumber
This works on both AD joined and Microsoft Entra ID joined devices.
(New-Object System.DirectoryServices.DirectorySearcher("(&(objectCategory=User)(samAccountName=$($env:username)))")).FindOne().GetDirectoryEntry().memberOf
Set NTP Server
This command sets the NTP server on a Windows. Multiple servers can be specified with spaces.
w32tm /config /manualpeerlist:"<ntpserverlist>" /syncfromflags:manual /reliable:yes /update