PowerShell Tip of the Week: Get IP address

There are multiple ways to get IP address information. Most common are ipconfig or Get-NetIPAddress command. Today I want to show you how to check this quickly using ping class. Get IP address To check IP configuration we can use one of the following one-liner commands Our script is based on .NET Framework System.Net.NetworkInformation ping class: Output: Results will be displayed in console and at the end saved into CSV …

Check SCOM Maintenance Mode history for multiple servers

Some time ago I posted short article about how to check SCOM Maintenance Mode history for single machine. Today I would like to share with you a little bit more advanced script which helps to check multiple servers. SCOM Maintenance Mode history To get above output we need to run the script on SCOM server. Remember that not all maintenance mode history can be found there. It will show only …

Get “User Rights Assignment” security policy settings

Recently I had to check if adfssvr account is present in “Generate security audits” policy settings. As I’m working in large scale environment and mostly on server cores it was obvious that it needs to be done by script. User Rights Assignment Below you can find list of user rights. In this example we will focus on SeAuditPrivilege – Generate security audits. More info about user rights – link. To …

PowerShell Tip of the Week: Get SCOM agent version remotely

In this short article you will find out how to get SCOM agent version. You can also check one of the previous articles about Microsoft Monitoring agent where you can check how to get other useful information like SCOM group name or management server. SCOM agent version If you have admin right in Operations Manager console then you can check this directly from SCOM server: Another way is to logon …

Export command output into two columns CSV file

Recently I was looking for easy way to export output into two columns CSV file. Finding solution for this was a little bit difficult because some values of the properties were another objects or they were for example data.table types. Below you will find how to do this based on one of the ADFS module commands. Get-AdfsRelyingPartyTrust The Get-ADFSRelyingPartyTrust cmdlet retrieves the relying party trusts in the Federation Service. You …

PowerShell Tip of the Week: Get SCCM client version remotely

In Todays tip you will find out how to check SCCM client version. To get this information we will use Get-WMIObject command. SCCM client version Information about SCCM client version is located under SMS_Client class in root\ccm namespace: You can also check SCCM client version remotely on servers from txt file list: To make the output look better we can use the following script.

Use PowerShell to format port query (PortQry) output

Recently I had to check connectivity to several servers on some specific ports using PortQry. As some of you already know this command will return some kind of the connectivity test report. I wanted to convert this into nice formatted table. Port Query Port Query – Display the status of TCP and UDP ports, troubleshoot TCP/IP connectivity and security, return LDAP base query info, SMTP, POP3, IMAP4 status, enumerate SQL …

PowerShell Tip of the Week: Get-Service example

Starting from today we will add also short articles with simple PowerShell examples once per week. Below you can find how to use Get-Service command against several servers and get nice formatted output. Get-Service The Get-Service cmdlet gets objects that represent the services on a local computer or on a remote computer, including running and stopped services. In this example we will limit our query to 4 properties: – MachineName …

Resend email if Send-MailMessage returns an error

Using Send-MailMessage command is pretty simple. However there are some situations where it might cause you some problems. I recently noticed that it sometimes returns timeout error – Error in processing. The server response was: 4.7.0 Timeout waiting for client input . To fix it I created simple loop to make 5 resend attempts – it can be useful if you had to add script to a task scheduler. Send-MailMessage …

Use PowerShell function to check if servers are accessible

Recently I had to check quickly if all of managed servers are accessible. As SCOM monitoring wasn’t set yet in my environment I had to create simple script to do that. One of the easiest method to check if server is up is to test availability of network share. Test-Path There are many ways to check if server is accessible like for example using ping, checking some specific service but …