Get and delete DNS A and PTR records via PowerShell
My Remote Desktop Session Host build process is now pretty slick. I can easily rebuild a lot of RDSH VMs very quickly. The process basically involved powering off the existing VM, deleting both it and...
View ArticlePowershell function to pin and unpin from Windows Taskbar
Wrote this to make it easy to add and remove pinned items from the taskbar. Code function Pin-Taskbar([string]$Item = "",[string]$Action = ""){ if($Item -eq ""){ Write-Error -Message "You need to...
View ArticlePowerShell: There are null values and then there are SQL null values
I was reading some data out of a SQL Server table, and wanted to do an operation if one of the string values returned, MAC, was either blank or null. I was using the following code: $NewServerName =...
View ArticleMissing row when using ExecuteReader to fill a DataTable
I’ve been using the following PowerShell code to retrieve the contents of an SQL Server table and store it in a DataTable for fast local processing: $BuildDBConnection = New-Object -TypeName...
View ArticlePowerShell: Finding user sessions on RDSH servers
If you’ve been working with Citrix Metaframe/Presentation Server/XenApp and/or Microsoft Terminal Server/Terminal Services/Remote Desktop Session Host for a while you’ll probably be familiar with the...
View ArticlePowerShell script to get temperature from NetBotz
Wrote this to extract the temperature reading from a few NetBotz devices that I have in my datacentres. Note that the second time I call the function, it is getting the temperature from a second...
View ArticlePowerShell: Find MTU
I had some issues caused by MTU recently, and decided to write a script to test for the Maximum Transmission Unit that a network or host could cope with. I originally started off by using the...
View ArticleRemove Forefront Client Security by force
I was recently trying to upgrade the Antivirus software on some servers from Forefront Client Security to System Center Endpoint Protection 2012 R2. On most servers it worked fine. However on a few I...
View ArticleSend Windows Event Logs to SQL Database
I’m currently in the process of planning for an AppLocker rollout to all my PCs (about 7,500 of them) due to an increasing amount of malware. You should probably be doing this too. Anyway, a sensible...
View ArticleSend notification email from SCCM 2012 Task Sequence
I wanted to be able to send an email from a step in a SCCM 2012 OS Deployment (OSD) task sequence. This was so that I could be notified when the task sequence had completed successfully. The account...
View Article