Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $NameSpace = "ROOT\citrix"
- $ClassName = "Citrix_PvDPool"
- # Change this value to the name of the desktop group you want to reset
- $DesktopGroupName = "My PVD Desktop Group"
- # Add Citrix PowerShell snap-ins
- asnp Citrix*
- Write-Host
- Write-Host "Preparing to reset the Personal vDisk on all VMs in Desktop Group " -nonewline; Write-Host -foregroundcolor green """$DesktopGroupName"""
- Write-Host
- Write-Host -foregroundcolor cyan "IMPORTANT" -nonewline; Write-Host " - please ensure all VMs are in a started and registered state!"
- Write-Host
- #Insert a pause
- Write-Host "Press any key to continue..."
- $x = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
- # Work out if all desktops are registered
- $PVDDesktopGroup = Get-BrokerDesktopGroup -name $DesktopGroupName
- if ($PVDDesktopGroup.DesktopsAvailable -lt $PVDDesktopGroup.TotalDesktops)
- {
- Write-Host
- Write-Host -foregroundcolor cyan "WARNING" -nonewline; Write-Host " - Not all desktops appear to be registered, are you sure you want to continue? If so, press any key..."
- $x = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
- }
- $PVDDesktops = Get-Brokermachine -DesktopGroupName $DesktopGroupName
- Write-Host
- Write-Host "Resetting Personal vDisks for the following machines:"
- # Perform the PVD Reset via WMI
- foreach ($PVDDesktopsMachine in $PVDDesktops)
- {
- Write-Host $PVDDesktopsMachine.DNSName
- Invoke-WMIMethod -Class $classname -ComputerName $PVDDesktopsMachine.DNSName -Namespace $namespace -Name Reset
- }
- Write-Host
- Write-Host "All done!"
- Write-Host
Advertisement
Add Comment
Please, Sign In to add comment