Password change WinNT
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
$pass = Read-Host 'What is your old password?' -AsSecureString
$pwdOld = [Runtime.InteropServices.Marshal]::PtrToStringAuto([Runtime.InteropServices.Marshal]::SecureStringToBSTR($pass))
$pass = Read-Host 'What is your new password?' -AsSecureString
$pwdNew = [Runtime.InteropServices.Marshal]::PtrToStringAuto([Runtime.InteropServices.Marshal]::SecureStringToBSTR($pass))
write-host "old pwd: $pwdOld"
write-host "new pwd: $pwdNew"
read-host 'enter to continue or break'
clear
$adsiInput = 'WinNT://domain1.global/samaccountname,user'
write-host "change for $adsiInput "
([adsi]$adsiInput).ChangePassword($pwdOld,$pwdNew)
$adsiInput = 'WinNT://domain2.global/samaccountname,user'
write-host "change for $adsiInput "
([adsi]$adsiInput).ChangePassword($pwdOld,$pwdNew)
samaccountname ist der benutzername
Dieser Eintrag ist vom Autor unter
CC BY 4.0
lizensiert.