Get Computer Name from Azure Device ID

We have multiple RRAS servers, and occasionally, I need to locate which one a client is connected to for troubleshooting. Now the RRAS console has some inconsistencies, sometimes it displays the computer name, sometime the Azure Device ID (Not the object ID) The Microsoft Docs on the Get-AzureADDevice is woefully incomplete, and it took me … Read more

Check language in Media Files

I have a largish media collection (mainly ripped DVDs) but noticed that somehow, I had managed to rip foreign audio instead of English. A little script can help identify these easily with the help of the PowerShell module “Get-MediaInfo” (The script will install this for you providing the first run is from an elevated PowerShell … Read more

PowerShell Script to check if certain Azure AD users are in certain Azure AD groups

A bit of a mouthful that heading! Basically, we use Azure AD groups to manage certain aspects of our MEM deployment. The script requires the AzureAD module (It will check for and prompt you to install it if you run the script as Admin) and a csv file with the users UPNs in a column … Read more

Powershell GEOIP Lookup using IPWhois.io

Sometimes, you want to look at a bunch of IPs and figure out where they are coming from. It could be firewall logs, maybe some web host logs. This script was originally developed for a very specific use case, it takes a bunch of IPs in a CSV (with a column header of ‘IP’) and … Read more

Tidy up Always on VPN Connections

We recently moved from a test to live implementation of Always on VPN, and moved our servers behind a load balancer, ratifying out profiles down to a single user and device tunnel. We found that deleting the old connections from Settings still left a bunch of stuff in the registry, so I came up with … Read more

How to unzip files in powershell

function Expand-ZIPFile($file, $destination) { $shell = new-object -com shell.application $zip = $shell.NameSpace($file) foreach($item in $zip.items()) { $shell.Namespace($destination).copyhere($item,16) #16 answers Y to any prompts, eg overwrite } } #call the function so: Expand-ZIPFile -file “c:\myfile.zip” -destination “d:\somedestination”  

Script to delete files older than x days

A quick script to delete files older than a certain number of days, be careful if you run this against a root dir!   ‘* Script Name: DeleteOldFiles.vbs ‘* Created On: 08/08/2013 ‘* Author: Jimmy White ‘* Version: 1.0 ‘NOTE! The Account used to run script needs delete permissions to folder & files. Const sSource … Read more

Displaying Network Adapter Speed with WMI via the Win32 NetworkAdapter class

Quick little script to do the above.. Function GetNetworkSpeed(strComputer) Dim colItems, objItem, address Dim StrQuery Dim objWMIService StrQuery = “SELECT * FROM Win32_NetworkAdapter” Set objWMIService = GetObject(“winmgmts:\\” & strComputer & “\root\CIMV2″) Set colItems = objWMIService.ExecQuery(strQuery,,48) For Each objItem in colItems GetNetworkSpeed = GetNetworkSpeed & vbTab & objItem.ProductName & vbCr Next End Function   Or do … Read more