$sNewPassword = "password"
$sComputer = @WKSTA
$sAdminName = GetAdministratorName
$oUser = GetObject("WinNT://" + $sComputer + "/" + $sAdminName + ",user")
$oUser.SetPassword($sNewPassword)
$oUser.SetInfo
Function GetAdministratorName()
Dim $sUserSID, $oWshNetwork, $oUserAccount
$oWshNetwork = CreateObject("WScript.Network")
$oUserAccounts = GetObject("winmgmts://" + $oWshNetwork.ComputerName + "/root/cimv2").ExecQuery("Select Name, SID from Win32_UserAccount" + " WHERE Domain = '" + $oWshNetwork.ComputerName + "'")
For Each $oUserAccount In $oUserAccounts
If Left($oUserAccount.SID, 9) = "S-1-5-21-" And Right($oUserAccount.SID, 4) = "-500"
$GetAdministratorName = $oUserAccount.Name
EndIf
Next
EndFunction