Month: August 2020

PowerShell: Remove Hyper-V VM Snapshots

Hyper-V's snapshot feature is a double-edged sword. It's a convenient method to make a quick…

PowerShell: Set Hyper-V Cluster Quorum

# setClusterQuorum.ps1 # version 0.01 $clustername=$null $clusterQuorum="\\FILESHERVER007\CLUSTER007" $resetPrior=$false function setClusterQuorum($clusterName,$clusterQuorum,$resetPrior=$false){ # Get clustername, if not…

PowerShell: Get Quorums of All Clusters in the Domain

# getClusterQuorum.ps1 function getClusterQuorum{ $allClusters=(get-cluster -domain $env:USERDNSDOMAIN).Name $results=@{} foreach ($cluster in $allClusters){ $quorum=Get-ClusterQuorum -Cluster $cluster…

PowerShell: Take VM Snapshots

# takeVmSnapshot.ps1 $vmNames='Test-VM1','Cowabunga-VM4' $snapShotLabel="Snapshot $(get-date -Format yyyyMMddTHHmmss)" function takeVmSnapshot([string[]]$vmName,[string]$snapshotLabel){ $vmClusterNodes=Get-ClusterGroup|?{$_.GroupType -eq 'VirtualMachine'} foreach ($vm in…

PowerShell: Disable Virtual Machine Queuing on Hyper-V Hosts

What is VMQ? Virtual Machine Queuing is a shortcut to deliver packet data from the…

PowerShell: Email Users with Expiring Passwords

# PasswordExpirationNotification.ps1 # Description: # This script performs the following tasks # a. Query Active…

PowerShell: Manage Remote Desktop Servers by Logging Off Idle Sessions That Have Certain Inactive Programs

# manageRdsSessions.ps1 # Sequence of workflow: # a. Gather active and disconnected sessions on all…

PowerShell: Find Duplicate RDP Sessions on All Remote Desktop Servers Discovered Within the Domain

There's this module called 'PSTerminalServices' that has a method to collect active sessions on all…

Setting Trace Logging for MS Dynamics CRM

Function 1: Set CRM Tracing # crmTraceLogSettings.ps1 $traceDirectory="L:\crmTraceLogs" $enable=$false $categories='*:\Verbose' $fileSize=10 $resetIis=$true function setCrmTrace{ param…

PowerShell: Move Files Into Zip

# moveFilesToZip.ps1 # Version 0.02 # This little function is to automate the process of…

Resolving LDAPS Connection Errors

Errors: Can not connect to remote server: 5059 ERROR_CERTIFICATE_ERROR (unable to read server certificates from…

PowerShell: Alternative to Test-NetConnection for Legacy Windows

This little snippet is useful as a helper function to quickly determine port connectivity between…

PowerShell: Find a Downloadable File from a Web Page

Although the function below is adequate for simple purposes. It lacks the advanced algorithm to…

Hyper-V: Attach a New Virtual Disk

$vmName='TestVm' $storageLocation='\\FILESERVER06\SHAREXOXO' $newDiskSize='100GB' $dynamic=$true function createNewDisk{ param( $vmName, $storageLocation, $newDiskSize='100GB', $dynamic=$true ) $ErrorActionPreference='stop' try{ write-host…

WinRM and Trusted Hosts for Non-Domain Computers

Error: [TESTWINDOWS] Connecting to remote server TESTWINDOWS failed with the following error message : Access…

PowerShell: Update Local Windows Machine

This script is meant to be ran on a local computer. To update remote machines,…

PowerShell: Update Remote Windows

This script has been deprecated in favor of a more universal one here. function invokeWindowsUpdate{…

PowerShell: Scan for Available or Unavailable IPs

This function is a demonstration of multi-tasking using PowerShell. The program will ping multiple targets…

Microsoft Dynamics CRM IIS Pool Service Account Configuration

Summary The default CRM installation wizard provides some flexibility in specifying a deployment account. However,…

PowerShell: Monitor a Program Wizard for Its Task Completion

Once upon a time in the realm of SysAdmin endless green pastures, there were rampant…