lastlogondate

Get users who haven’t logged in longer than X days (LastLogonDate)

Find out how to get users who haven’t logged in longer than X days. In today’s post, I wanted to share a simple Active Directory inventory script. It is using AD module commands and saving results into a CSV file. LastLogonDate This script might be useful in getting users that haven’t logged for a longer amount of time. It is checking lastlogondate property: Please be aware that it gets a …

KeyVault expired

Get Azure Key Vault expired secrets

Hey Scripters! If you want to gather Azure Key Vault expired secrets by the script, today is your lucky day – I’ve prepared script for that 🙂 I was searched for some easy functionality which will easily notify me about Key Vault expired secrets. The only solution I found is Events functionality in Key Vault. However after few of my test (during writing this article this option is still in …

empty groups

Get Active Directory empty groups

Recently I was asked to find all Active Directory empty groups. In this case, I was using ActiveDirectory module commands with LDAP filters. Active Directory empty groups The Get-ADGroup cmdlet gets a group or performs a search to retrieve multiple groups from an Active Directory. The Identity parameter specifies the Active Directory group to get. You can identify a group by its distinguished name (DN), GUID, security identifier (SID), Security Accounts Manager (SAM) account …

Get Azure virtual machines without NSG and ASG assigned

Hi Scripters! Today I’ve got for you awesome script which will generate report with information about Azure virtual machines without NSG and ASG assigned. For non-Azure related people – Network Security Groups and Application Secuirty Groups are Azure network security concepts, which allows to filter/block virtual machines network traffic and easily group them according to ports which should be used by specific type of application. Both NSG and ASG are …

loganalytics

Add Saved Queries to Log Analytics

Hey Folks, in today’s article want to show you how to add saved queries to log analytics in all subscriptions for the same tenant. Log Analytics is a service which allows you to store all logs from all your Azure services in one place. It allows in easy way to create query useful for us and gather all information which are needed for us. In one of the article my …

OU

Get computer objects from OUs

In this short article, I would like to share the PowerShell script for getting computer objects from parent Organizational Units (OUs). Organizational Unit (OU) is a container in the Active Directory domain that can contain different objects from the same AD domain: other containers, groups, user and computer accounts. Get computer objects Recently I was asked to prepare a report in Excel and count objects in each OU. To do …

occurrence

PowerShell Tip of the Week: Count occurrence of each element

How to count the occurrence of each element. Today I would like to share a few examples describing how it can be done. To do this we can use Group-Object cmdlet. Count the occurrence The Group-Object cmdlet displays objects in groups based on the value of a specified property. Group-Objectreturns a table with one row for each property value and a column that displays the number of items with that value. Example: Get …

Get Azure resources details using PowerShell

Hello scripters, Today I want to share with you my script for gathering Azure resources details. Script is connecting to Azure subscription and take all resources base on resource groups names provided as input parameter. In the result table with Azure resources details such as Resource Group, Resource Name and Resource Type will be created and expoted to CSV file. You can define folder to which CSV file should be …

Quick Test-NetConnection

PowerShell Tip of the Week: Quick connection test on remote machines

I’m often asked how to quickly test connectivity on remote machines. In this short article from PowerShell tip of the week series, I wanted to share such script with you. I hope that it can be useful for some of you. Quick connection test Basically, the script is based on Test-NetConnection command. I running it inside single Invoke-Command script block. The Invoke-Command cmdlet runs commands on a local or remote computer and …