Useful script to go after servers in VMM and output the list to a csv file.
Continue readingCategory: PowerShell
PowerShell
PowerShell script to convert string to encrypted password and back again
I’ve found it useful to store an encrypted password in a file on disk. However, this is not generally a good idea but at least […]
Continue readingUseful Scripts
PowerShell: $ou = [adsi]”LDAP://OU=Marketing,OU=Departments,DC=Company,DC=Domain”; $user = $ou.psbase.get_children().find(‘CN=UserName’); $user.psbase.invokeSet(“allowLogon”,0); $user.setinfo(); Bash: #!/bin/bash fname=”/path/file” tname=”/new/file.tmp” i=”0″ DATE=$(date +%Y%m%d%H%M%S) sudo cp “$fname” “$fname”.$DATE while IFS=” read -r line […]
Continue readingGet All Installed Software Using PowerShell
The following PowerShell script will return all installed software on a Windows server. function GetInstalledMSIVersionNumber($MSIName) { #Define the variable to hold the location of Currently […]
Continue readingPowerShell Script to Recursively Zip All Files in Folder
I’ve enclosed a simple PowerShell script to recursively zip files using the built in shell. Works in PowerShell 2 and 3, no additional zip applications […]
Continue readingPowerShell Script Execution Policy
The Set-ExecutionPolicy cmdlet enables you to determine which PowerShell scripts will be allowed to run on your computer. PowerShell has four different execution policies: Restricted […]
Continue readingUse PowerShell to Uninstall an Application – Comparing WMI vs. a Registry Scan
If you have ever scanned the list of currently installed programs using the WMI Win32_Product class, you’ve noticed that the scan runs slow! This always […]
Continue readingPowerShell command to check if a directory exists and if not, create it
I often have to look up this simple PowerShell command. The following command checks if a folder exists and if not, creates it. Works great. […]
Continue readingUse PowerShell to list all property values from a registry entry
I’ve had to use a variation of this script many times and each time I’ve been stumped for 30 minutes before coming to a solution. […]
Continue readingStudy an Exception in PowerShell
PowerShell may not return enough information in an exception. You can read the response stream to dig deeper: $stream = new-object System.IO.StreamReader($Error[0].Exception.InnerException.Response.GetResponseStream()) $results = $stream.ReadToEnd() […]
Continue reading