PowerShell Tip of the Week: Get FQDN

Today I want to show you how to use .Net class to get FQDN (Fully Qualified Domain Name). A fully qualified domain name is the complete domain name for a specific computer. The FQDN consists of two parts: the hostname and the domain name like for example: DC01.powershellbros.com Get FQDN In this article we will focus on DNS class which is a static class that retrieves information about a specific …

Update XML file remotely using PowerShell

Updating XML file is pretty simple. The more difficult part is to do this remotely and create nice formatted output. In this article I will try to explain how to do this in simple way. Updating XML file Lets say that structure of our Web.Config XML file will look like this and we want to check value from Encryption key: Configuration -> AdfsConfiguration -> Certificate -> Add To import file …

Get memory utilization report using PowerShell

A long time ago I added short article about checking CPU and Memory utilization. This time I wanted to create simple report with few additional details. Memory utilization Checking memory utilization can be done in multiple ways. This time I want to show you how to do this using Get-WMIObject command. Here you can see simple one-liner script to check top 5 processes: As you can see above output doesn’t …

PowerShell Tip of the Week: Taskkill remotely

Taskkill command can be very useful when it comes to daily operational tasks. I often had situation that several ADFS web servers were not working properly. Recently I’ve been flooded by SCOM alerts about service failure. First recommended step is to restart ADFS service. Unfortunately normal service restart does not solve the issue. Taskkill command comes to rescue – it allows to terminate completely affected process. Taskkill Ends one or …

Clear resources in Azure subscription

Christmas is coming, so it’s good time to clear resources in Azure subscription :). Today’s article will show you how easly do it via Powershell. To make long story short – script is scanning for all resource groups in selected subscription. For each of the resource group it displays all resources and user can decide if whole resource group should be removed or not. Script: Output: Attention! Powershellbros do not …

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 information can be found there. It will show …

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 …