HomeDocumentationAPI Reference
Log In
These docs are for v23. Click to read the latest docs for v33.

Password rotation does not work for Windows 2012 R2

Windows 2012 R2 uses Powershell 4.0, which is not supported by default by password rotation templates. Workaround is to create a separate Powershell 4.0 compatible template in /privx/deployment/password-policies and use that for rotation.

####################
#
# Windows 2012 R2 password rotation via administrator account template
#

@list_format=$username:$password
@list_item_prefix=""
@list_separator="\", \""

#
######################

$array = @("$user_password_list")
foreach ($userpw in $array) {
	$upwArray =$userpw.Split(":")
	$username ="WinNT://./" +$upwArray[0]
	([ADSI]$username).SetPassword($upwArray[1])
}