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 …

How to find expired certificates

Hey folks, in today’s short article I will show you how in easy way check expired certificates. Script which I prepared is very easy and yes I know that it can be done in one-liner. 🙂 However I’ve decided to split it for few phases: Phase 1 – Check actual date Phase 2 – Gather all certificates Phase 3 – Filter only objects which are certificates and NotAfter attribute is …

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 …

Generate patch report from WSUS

Hey scripters, today I want to share with you my script for generate patch report from WSUS. On our blog we already show you how to check if specific patch is installed on your machine. But what in case that we want to generate report for servers\workstations which are managed by WSUS? There are many of other tools which can better manage patch management process, however some environments still need …