Posts

Apply tags to azure resource groups from csv file

Image
This script is used to apply tags as per a csv file. Tags will be applied in uppercase. If a resource group is present in the csv but not in Azure it will be skipped. A log file will be generated in the log folder. A backup of the resource groups previous tags and values will be created in the backup folder. This script has been moved to GitHub, link below:

List object contributors in all Azure subscriptions with Powershell

Image
The below script will loop through all Azure subscriptions excluding Visual Studio subscriptions, it will then look at every object and list/export everyone who has a role that has the word "Contributor" in it. This script has been moved to GitHub, link below: Example below:

List printers and IP addresses on a windows server using Powershell

Image
  This script has been moved to GitHub, link below:

Stop and disable a Windows service using powershell

Image
Populate "computers.txt" with all the server names you wish this to run on then adjust the script to fit the service you require. This script has been moved to GitHub, link below:

Split file every xxx lines with Powershell

Image
I recently ran in to an issue whilst using CommVault to restore some archive files from it's HSM. You have to run the gxhsmutility to scan the files to check if any stub files remain, if there is it outputs what is called a map file, you then run the restore again pointing to said map file. The problem with this was that if the map file was over 100,000 lines the recovery would just crash, so I wrote this to split the map file out in to multiple map files I could then use to recover the data. This script has been moved to GitHub, link below:

Add random number prefix to filename with Powershell

Image
This allows you to add a randomly generated number to the prefix of a bunch of files. In the below example we are adding a random prefix to every *.jpg file. This script has been moved to GitHub, link below:

Ping Monitor Batch File With Colour Changes

Image
A script to continuously monitor an IP address and give clear indications when up or down with timestamp, handy for trouble shooting a network/server issues. Copy and paste in Notepad and save as a batch file: @echo off SET OUT=0F color %OUT% mode 44,20 echo mode 44,20 echo off & cls Title = Ping monitor set /p IP=Enter your IP Address : :top set mytime=%time:~0,2%_%time:~3,2%_%time:~6,2% set mydate=%date% PING -n 1 %IP% | FIND "TTL=" >nul IF ERRORLEVEL 1 (SET OUT=4F & echo %mydate% : %time:~0,2%:%time:~3,2%:%time:~6,2%% : Down & Title Down %IP%) ELSE (SET OUT=2F & echo %mydate% : %time:~0,2%:%time:~3,2%:%time:~6,2%% : Up & Title Up %IP%) color %OUT% ping -n 2 -l 10 127.0.0.1 >nul GoTo top