Pull server name from ADFS eventlog and check LDAP connection

When it comes to ADFS, network connectivity to the global catalog servers is one of the most important aspects. You may often see in ADFS logs that LDAP server returned a specific error when it was queried or it’s even unresponsive. As an engineer you need to determine either its temporary network connectivity problem or maybe something wrong with one of your Domain Controllers. I also had this problem so …

Get total number of group membership for specific user

This time I want to show you how to get number of direct and indirect(nested) group membership for specific user. Please note that once user is a member of about 1000 groups, some SIDs can’t be added to the token. This will cause an access failure when trying to use a resource that requires that token. As we all know error handling is very important so I added Try/Catch block …

Run script to check CPU and Memory utilization

If you would like to quickly display CPU and Memory utilization in PowerShell console then this script is for you. This is another great example on how to use PowerShell custom objects and add it to array. CPU and Memory utilization In past I often had this situation when one of the servers was unresponsive due to high performance which was causing service interruption. Unfortunately SCOM server didn’t catch that …

Using Out-GridView with -PassThru parameter to select multiple objects

If you were wondering how to select multiple objects from pop-up window using PowerShell then this post might be interesting for you 🙂 I would like to show you how you can easily select your servers with Out-GridView command. In this example I’ve created simple script where you can choose multiple servers for example for post patching reboots. On the beginning I added some short title: When you press enter …

Create your own HTML formatted report – email

Today I would like to share with you one of the basic templates which I’m using for sending HTML reports via PowerShell. Article contains full description on how to prepare table and add to it user data gathered from Active Directory. Output will be send to your mailbox in nice HTML formatted report. HTML formatted report First we need to define columns names and add them to our table: After …

Scanning XML file from internet – O365 Products

Recently I worked on script for checking if IP address found in ADFS dedicated load balancer logs matches the Office 365 products IP address ranges/subntes. List of products and IP address can be found on office support page and to make things easier XML file is also provided – link. For checking if IP address exists within subnet I let myself use the script from internet: http://www.gi-architects.co.uk/2016/02/powershell-check-if-ip-or-subnet-matchesfits/ We have script …

Use PowerShell to find specific SSL server certificate

This article might be useful if you have list of servers on which you want to make simple scanning for specific SSL certificate. In this example we will search for certificate which name contains word token. Please note that searching criteria should be based on your internal naming convention for certificates. Certificate location (Cert:\LocalMachine\My): Script can be run also as a verification step after certificate replacement activity. Output: Final script:

Get list of disabled ADFS relying parties

If you’re working with ADFS and your environment contains lots of Web Applications, this article might be useful for you. You can be asked at your work to get the list of disabled relying parties from ADFS database, especially in bigger companies. First of all we have to ensure that federation services cmdlets are installed. To get list of available modules you can run the following command: Get-Module -ListAvailable Another …

Reboot server remotely via PowerShell

Reboot 🙂 I guess that all of the server administrators had this situation when server was not responding. If you don’t have access to iDRAC, iLO .etc the only way to fix the issue will be rebooting server remotely. So today I would like to show you couple of ways to do that. The easiest way is to run cmd as an administrator and use command: SHUTDOWN /r /f /t …

Create your first PowerShell function

For those who are starting their journey with PowerShell I prepared today short article describing how to create first simple function. To makes things a little bit complicated I added if/else conditions to give better functionality to our script. Function name is called Get-Sessions and it will check for Active Directory users sessions and status on some particular server.   I used if/else conditions to make sure that person who …