Archive | August 2014

Remotely set DNS Primary and Secondary Servers via PowerShell

Create a text file with a list of server names that you would like to change Primary & Secondary DNS for:



#PowerShell Script:
$computer = get-content C:\temp\servers.txt
$DNSServers = “”,”″
$NICs = Get-WMIObject Win32_NetworkAdapterConfiguration -computername $computer |where{$_.IPEnabled -eq “TRUE”}
Foreach($NIC in $NICs) {$NIC.SetDNSServerSearchOrder($DNSServers), $NIC.SetDynamicDNSRegistration(“TRUE”)}


Remove “Unknown” computer from System Center Configuration 2012 R2 Manager PowerShell

Recently while testing out some task sequences with non-domain systems, I ended up with a bunch of “Unknown” computers in the Devices list in SCCM.  While I could filter this and remove it easily from the console, I wanted to set a task sequence to continually run through process while testing.

First, open PowerShell from Configuration Manager (to easily load the SCCM PowerShell Modules)

#Define your 3 character site code with this variable, in my example “ABC.”  I have defined the Site Code as I didn’t want the inherent x64 & x86 Unknown Computer Devices to be filtered from my results.  You could replace Unknown with another computer name, import a list via CSV, etc.

$sitecode = “ABC”
$devicename = “Unknown”
Get-CMDevice | Where-Object { ($_.SiteCode -ne $sitecode) -and ($_.Name -eq $devicename) } | Remove-CMDevice -force -confirm:$false


Note:  Please do this at your own risk – I’d suggest lab testing this first. 😉

Manually Remove Incidents, Service Requests, etc. from Service Manager 2012/2012 R2

With System Center Service Manager 2012/2012 R2, you may find you need to delete various Incident Requests, Service Requests before waiting for them to prune out of the database.  This could apply in a testing situation, when you are generating lots of test tickets, etc. (Or if you find you have a Operations Manager alert storm!).  From PowerShell with the Service Manager module loaded, run the following commands:
#Remove IR from Database.  Replace IRx with corresponding Incident Request number (ie. IR16, etc.)
Get-SCSMClassInstance -Class (Get-SCSMClass -Name System.WorkItem.Incident) | Where-Object {$_.ID -eq “IRx”} | Remove-SCSMClassInstance
#Remove SR from Database.  Replace SRx with corresponding Service Request number (ie. SR16, etc.)
Get-SCSMClassInstance -Class (Get-SCSMClass -Name System.WorkItem.ServiceRequest) | Where-Object {$_.ID -eq “SRx”} | Remove-SCSMClassInstance

Refresh your SCSM Console and it should now be gone from the list.

The Service Manager data warehouse SQL Reporting Services server is currently unavailable

Recently, while rolling out System Center Service Manager 2012 R2 for a customer, I received the following error when opening Service Manager as it attempted to load the SQL Reporting Services plugin: “The Service Manager data warehouse SQL Reporting Services server is currently unavailable.  You will be unable to execute reports until this server is available.”


The even log showed Event ID 33569:

Cannot connect to SQL Reporting Services Server.  Message= An unexpected error occurred while connecting to SQL Reporting Services server: System.Net.WebException: The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel. —> System.Security.Authentication.AuthenticationException: The remote certificate is invalid according to the validation procedure.

The last line was the key.  Ideally you would want to put a trusted cert from your CA onto the SQL Reporting Services Server but the work around would be to make the certificate trusted on the machine running the Service Manager Console.

Browse to the SQL Reporting Services web page, click past the cert error.

Click on the certificate icon at the top and “View Certificate”

Install the certificate into your local machine Trusted Root Certification Authorities.

Now go back and re-open the SCSM Console and all should be good!