Citrix PVS Reset Machine Account Password

For a machine streamed using Citrix Provisioning Services, marks the device as down, resets the Active Directory machine account password and reboots the device. This action should be executed on a PVS server with MCLI PowerShell snap-in installed.
Version 3.3.10
Created on 2014-06-22
Modified on 2014-07-02
Created by ControlUp Support
Downloads: 313

The Script Copy Script Copied to clipboard
$devicename = $args[0].Split(".")[0]

Import-Module "C:\Program Files\Citrix\Provisioning Services Console\McliPSSnapIn.dll"  -ErrorAction SilentlyContinue -WarningAction SilentlyContinue

# If Import-Module was successful...
if ($?) {
    Mcli-Run Reboot -p DeviceName=$devicename
    Mcli-Run MarkDown -p DeviceName=$devicename
    Mcli-Run ResetDeviceForDomain -p DeviceName=$devicename
    # if ResetDevice was successful...
     if ($?) {
      Write-Host "AD account reset. Rebooting device..."
     }
}