diff --git a/Set-DefaultAdministratorCredentials.ps1 b/Set-DefaultAdministratorCredentials.ps1 new file mode 100644 index 0000000..ddc4608 --- /dev/null +++ b/Set-DefaultAdministratorCredentials.ps1 @@ -0,0 +1,7 @@ +If ( $(Get-CimInstance -ClassName Win32_OperatingSystem -Property ProductType | Select-Object -ExpandProperty ProductType) -eq "2" ) { + Microsoft.Powershell.Utility\Write-Output "Cannot create or modify local accounts on a domain controller" + Return +} +Write-Output "Setting local Administrator password" +Try { net user Administrator $Password /times:all /active:yes } +Catch { Write-Error $_.Exception.Message } \ No newline at end of file