Remote initialize and format newly added harddrive

Handy little script that initializes your newly added harddisk and then format it.

function initalizeDisk ($dnsname)
$psremote = New-PSSession $dnsname
Invoke-Command -Session $psremote { Get-Disk |

Where partitionstyle -eq 'raw' |

Initialize-Disk -PartitionStyle MBR -PassThru |

New-Partition -AssignDriveLetter -UseMaximumSize |

Format-Volume -FileSystem NTFS -NewFileSystemLabel "WriteCache" -Confirm:$false



Print test page to all your printers from Powershell

I recently had a task, requiring me to print a testpage to all printer queues on a printserver. With somewhere around 150 queues, this is certainly something i won’t do manually. So i created a little snippet to perform my task.

I know this could be done in one line, but I really dislike that way of writing code.

$printers = Get-Printer | select Name

foreach ($printer in $printers) {

Write-Host "Spooling Test Page to Printer: " $

rundll32 printui.dll,PrintUIEntry /k /n $


Duplicate all applications in XenDesktop 7 to new delivery group

This little powershell script will get all current applications from your current delivery group, and duplicate it to a new. 

asnp citrix*

$apps = Get-BrokerApplication | select BrowserName

foreach ($app in $apps)
$in = Get-BrokerApplication -BrowserName $app.BrowserName
Write-Host “Duplicating app to new deliverygroup: ” $in.BrowserName
#$in | Add-BrokerApplication -DesktopGroup “Server 2012v2″



Unable to launch as the application is not currently available but is working via StorefrontWeb

So this was also really crappy, systems have been working and tested for a while. After some kind of SQL issues last night, we had troubles logging in through Receiver, but from Web working ok.

Found the resolution BUT no root cause, as this was working and suddenly stopped working.

But here is what fixed it.


On your XenDesktop controller run this.

PS C:\Users\> asnp citrix*
PS C:\Users\> Set-BrokerSite -TrustRequestsSentToTheXmlServicePort $true

Cannot connect to the Citrix XenApp server. Protocol driver error.

Lets face it, I am new to Netscaler products. But normally I get around and fix the things I need.

Today I was working on a second vServer for access to a test environment. And when connecting i was getting this annoying error message, that really does not say much. And google, does not point you anywhere close to a solution either.

Protocol driver error.

This KB CTX911130 has a few reasons in it, but no one related to my issues. 

Finally I found what really was causing me problems, I did not configure additional static route for the network used by Citrix servers in the test environment.

This bothers me a lot, because it seems like an obvious reason for the protocol driver error, to a Netscaler veteran. Which makes me think that this should be an obvious CTX easy to find when googling Netscaler Protocol driver error.


Changing domain password on Server 2012

On a direct RDP connection press ctrl+alt+end to bring up the change password choice.

If you are on a RDP in RDP session the story is a bit different and a little bit tricky as far as my research has come up to, as the ctrl+alt+end will bring up change password from parent rdp session.

The only solution i have found is to create a small vbs and trigger it from there.

set objShell = CreateObject(“shell.application”)

save this as a .vbs file

run cscript your.vbs