<< Back to Script Library

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: 2014-06-22
Modified: 2014-07-02
Creator: ControlUp Support
Downloads: 311
Tags: machine account powershell PVS xenapp xendesktop
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..."