Browsed by
Month: December 2015

Remove List of SCOM Orphaned Agents in PowerShell

Remove List of SCOM Orphaned Agents in PowerShell

I faced this need for a customer need, so I wanted to share with you this little article. In order to remove a list of SCOM orphaned agents (e.g. computer doesn’t exist anymore) you can use this script. Obviously, it will only remove agents from SCOM console, but it will not uninstall agent from the computer (we will see how to manage this in another article).

You can actually use either a plain list of gray agents or .csv file as…

Read More Read More

Access SQL Server (Integrated Security) with Different Windows Credentials in PowerShell

Access SQL Server (Integrated Security) with Different Windows Credentials in PowerShell

I needed to get data out of a SQL Server instance that used integrated windows security through a PowerShell script. But the user that has access to the instance is a domain user account different to the user logged on when running the script. So I developed a mechanism to invoke my SQL commands as a script block of a job because a job can be started with different credentials. You can find below my PowerShell script that connects to a…

Read More Read More

Dates and Time Zones in PowerShell

Dates and Time Zones in PowerShell

If you have already played with dates in PowerShell, you’ve probably realized that it was not so simple. If you are a beginner, I recommend you to read this article to get some basics about dates and times in PowerShell. On this article, we will focus on time zones, time offsets, and daylight-saving times. Actually, you can retrieve upcoming daylight saving time clock changes here. In this case, my computer time is based on UTC +01:00 (Central European Standard Time) timezone. Let’s make a…

Read More Read More

Restart Windows Computer Remotely Through a SCOM Agent Task

Restart Windows Computer Remotely Through a SCOM Agent Task

One of the needs of my customer was to be able to reboot any Windows computer (with SCOM agent) remotely without having local administrator rights. I figured out that the best way to accomplish this would be to create a SCOM agent task (not a console task), that you can call from anywhere (script, runbook, etc.). The main advantage is that tasks run under the credential of the Default Action Account on the agent computer. This account typically has sufficient…

Read More Read More