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:

remotednschange1

 

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

remotednschange2

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)
removeunknowndevice1

#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

removeunknowndevice2

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:
RemoveInstance
#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
or
#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
RemoveInstance2

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

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.”

SCSM-SQLReporting

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.
SCSM-SQLReporting2

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.
SCSM-SQLReporting2a

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

Install the certificate into your local machine Trusted Root Certification Authorities.
SCSM-SQLReporting3
SCSM-SQLReporting4

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