Script Repository

Throughout my work as an IT administrator, I often have to invent solutions my-self.

On this page, I share all of my scripts built to make the life of an IT administrator easier.

Feel free to download, improve, and share my work!

BitLocker

BitLockerMagic
A PowerShell script bundled with a tool from Dell to automatically set a BIOS password, activate TPM, and encrypt the hard drive. Can be run with a GPO or similar to force all computers in a domain to use BitLocker.
Download

VerifyBitLocker
A PowerShell script to verify the BitLocker status on all computers in a given OU.
Download

DNS

Add-MissingPTR
A PowerShell script to search for and add missing PTR records for static A records in a given Active Directory domain.
Download

Misc

ResetLocalPassword
A PowerShell script bundled with a free tool to reset a local password. Run the script to remotely reset the password for a local account on any computer or server. Useful if you want to change the password for the local Administrator account on all your servers.
Download

Run-RemoteScript
A PowerShell script bundled with PsExec to start CMD on a remote computer. Run the script to copy and run a batch file on a list of remote computers.
Download

Kill-ProcessWoConnection
A PowerShell script to find certain processes without a coresponding TCP connection, and kill it.
Download

WinSCP-Transfer
A PowerShell script to send or synchronize files to a remote SFTP server (FTP over SSH). The script uses WinSCP (need to be installed separatly) to connect to an SFTP server. It also logs the session to a log file.
Download

Nagios

NagiosSupervisor
A PowerShell script to monitor if Nagios is up and running. If not, it will send an e-mail alert. The script logs to a log file at each run which can be monitored in Nagios. In this way, Nagios and the this script will monitor each other.
Download

check_ad_replication
A PowerShell script to let Nagios monitor an AD replication status.
Download

check_ag_failover
A PowerShell script to let Nagios monitor the failover mode on SQL Availablity Groups.
Download

check_citrix_logon
A set of tools to check if one or more Citrix sessions (desktop or app) are working and to mesure the logon time.
Download

check_cluster_node
A PowerShell script to let Nagios monitor the nodes within a Windows Failover Cluster.
Download

check_cluster_resource
A PowerShell script to let Nagios monitor the resources within a Windows Failover Cluster.
Download

check_clustervolume
A PowerShell script to let Nagios monitor the shared volumes within a Windows Failover Cluster.
Download

check_file_time_content
One of my favorite PowerShell scripts to let Nagios monitor a file. The script does not only monitors when the file is last edited, but the content in it as well.
Download

check_tcp_sessions
A PowerShell script to count the number of TCP sessions with a given port number or range, and state.
Download

check_user
PowerShell script to let Nagios check if a specific user is logged on to a given server. Helpful when certian batch processes requires a user to be logged on.
Download

check_vm_backup
A really powerfull PowerShell script to let Nagios check if Veeam has backed up all or some of the servers in a VMware vSphere environment. Configure Veeam to set a custom attribute on the VMs after each backup, and this script will parse that attribute and make sure a backup is taken. Helpful to find servers you might have forgot to add to your backup job.
Download

check_xenapp_load
A PowerShell script to let Nagios monitor the load of a Citrix Virtual Apps (XenApp) Delivery Agent server.
Download

check_xenapp_sessions
A PowerShell script to let Nagios monitor the number of sessions (both active and disconnected) on a Citrix Virtual Apps (XenApp) Delivery Agent server.
Download

SCCM

Check-LocalGroup
A PowerShell script built to operate as an Configuraiton Item in SCCM for compliance check. The script compares any given local group’s members with an array of allowed members and return the compliance result.
Download

Virtual Apps

Rotate-VirtualAppsServers
A PowerShell script to “rotate” Citrix Virtual Apps (XenApp) Deliver Agent servers. Useful if you’re using Citrix PVS (Provisioning Services) and have a new image you want to distribute. The script puts selected servers in maintanance mode, starts up new servers and powers off the selected servers.
Download

Reset-CitrixWorkspace
A PowerShell script that uses the CleanUp.exe and SelfService.exe executlables that comes with the Workspace client, to clean-up the configuration, remove all shortcuts created by the client, and then polls for new and changed shortcuts.
Download

WSUS

WSUS_CleanUp
A PowerShell script to do some maintanance on a Windows Server Update Service server. The cleanup is more or less required if you don’t want to fill up the disk with unneeded data.
Download

WSUS_Reset_Windows_Update
A PowerShell script that removes all Windows Update cache and settings, and do a complete reset. The script will run a discovery and gpupdate at the end to fetch relevant Windows Update settings again for a WSUS environment.
Download