Send 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 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 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 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 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: 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 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: 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 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 ArticleGet 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 ArticleBasic RDS 2012 R2 Shadowing Console
Whereas older versions of Windows had the tsadmin.exe utility, Server 2012 R2 doesn’t have anything equivalent. Helpdesk staff need a simple, easy to manage and configure console to allow them to...
View ArticleBrowse for and display a PowerShell Clixml file in a DataGrid window
I’ve been using Out-DataGrid a lot recently, I seem to have a lot of uses for it. One of the things I’m displaying is an array of custom objects. Sometimes the script that generates this data takes a...
View ArticleFind vSphere VM locations: Folder, vApp and Resource Pool
The vSphere client doesn’t seem to give you a nice overview where you can see all the location data about your virtual machines. You can see the Folder and vApp by expanding all the branches in the VMs...
View ArticleSearch for VMware RDMs
A storage admin recently asked me if a couple of LUNs were still in use. They had very little info about them, but knew they were presented to the vSphere hosts. So I wrote a quick script to find all...
View ArticleLogon scripts do not run at logon – Server 2012 R2
Another genius bit of fiddling by Microsoft means that on Server 2012 R2 and Windows 8.1, logon scripts no longer run as part of the logon process. This had me totally foxed for hours. I have my logon...
View ArticleScript comparison: CMD, VBScript, Powershell
This was going to be a short scripting exercise for a new member of staff, but has been ditched due to time constraints. I’d written some sample scripts to see how long it’d take, so thought I’d post...
View ArticlePowerShell: Parallel ping test with CSV result files
I’ve been experimenting with parallel workflows in PowerShell and this seemed like a good thing to try and do with it. No guarantees that this script is the best, but it does work. Give it a list of...
View ArticlePowerShell: Mounting and dismounting ISO images on Windows Server 2012 and...
Had need to do this recently, and as per usual with powershell, it was kind of easy, but there were a few fiddly bits that don’t appear to have been thought through by the designers. Note that as the...
View ArticleGetting PowerShell scripts to run with no prompts
I am currently experimenting with Windows Server 2012, System Center Virtual Machine Manager 2012 SP1, and automation of various processes related to creating/building Server 2012 virtual machines. I...
View ArticleAutologon after creating virtual machine from template with VMM 2012 SP1 beta
I’ve been having a fun time trying to get System Center Virtual Machine Manager 2012 SP1 beta to do things. It’s been even more fun when I’ve been trying via the delightful PowerShell – I want to get...
View Article