Search
What's Hot
Pages
Affiliate Offers
Blogs worth reading
Me in the Real World
More of my stuff
Music
Feeds
Category Archives: Scripting
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 used to … Continue reading
Send 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 first step is to … Continue reading
Posted in PowerShell, Scripting, Security, Windows
Tagged active directory, applocker, audit, collect, collection, datatable, event, event log, events, forward, gppref, group policy, log, monitor, mssql, mssqlserver, network service, preference, push, send, sql, sql server, sqlbulkcopy, windows
4 Comments
Remove 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 was unable to remove some of … Continue reading
Posted in Scripting, Security, Windows
Tagged clean, client, endpoint, endpoint protection, fcs, force, forefront, forefront client security, protection, remove, scep, script, security, system center, tidy, uninstall, windows
3 Comments
PowerShell: 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 PowerShell Test-Connection cmdlet, but … Continue reading
Posted in Networking, PowerShell, Scripting
Tagged determine, find, maximum, mtu, powershell, script, test, transmission, unit
2 Comments
PowerShell 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 (non-docked) sensor pod attached to … Continue reading
Posted in PowerShell, Scripting
Tagged extract, get, netbotz, powershell, scrape, script, temperature
Leave a comment
PowerShell: 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 command line utility quser (or query user). It returns a tabular output showing details of … Continue reading
Posted in PowerShell, Remote Desktop, Scripting
Tagged find, powershell, query, quser, remote desktop, session, terminal server, user, windows, wmi
Leave a comment
Missing 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 System.Data.SqlClient.SqlConnection -ArgumentList “Server=RCMSQL01;Database=TSBuild;Integrated Security=SSPI” $BuildDBConnection.Open() # Get Main table $SQLCommand … Continue reading
Posted in PowerShell, Scripting
Tagged datatable, executereader, fill, missing, powershell, read, row, sql, sqldataadapter
Leave a comment
PowerShell: 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 = “SomeServerName” $DBServerName … Continue reading
Posted in PowerShell, Scripting
Tagged blank, dbnull, if, null, powershell, sql, system, test
2 Comments
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 its Active Directory account, and … Continue reading
Posted in PowerShell, Scripting, Windows
Tagged a, delete, dns, find, get, get-dnsserverresourcerecord, look up, nslookup, powershell, ptr, record, remove, remove-dnsserverresourcerecord
4 Comments