Category Archives: PowerShell

Faster Where-Object In PowerShell

One of the worst features of PowerShell for me is extremely slow performance in loops, especially using items like Where-Object { $_.Name –eq “value” } For performance critical loops I use inline C# Here is an example to search data … Continue reading

Posted in Performance, PowerShell | Leave a comment

Simple WMI Trace Viewer in PowerShell

Run this script as local Administrator to start tracing WMI events. When you are done tracing hit ENTER to view the results. This does not display all WMI trace events, check the WMI Activity Trace event log in Windows Event … Continue reading

Posted in Debugging, PowerShell | Tagged | Leave a comment

Encrypt Password In CTX1 Encoding With PowerShell

Encrypts the password in a reversible format, the format used in some Citrix applications.

Posted in PowerShell | Tagged | Leave a comment

Misleading PowerShell Exceptions–Example #1

In PowerShell 5.0 on Windows 10 was looking at a script with function not working: The exception thrown by Powershell was: You cannot call a method on a null-valued expression.At C:\Users\chentiangemalc\Documents\Scripts\Test.ps1:5 char:9+     if ([System.String]::IsNullOrWhiteSpace($condition))+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~    + CategoryInfo          : InvalidOperation: (:) … Continue reading

Posted in Debugging, PowerShell | Tagged | Leave a comment

Check Validity and Download SSL Certs in PowerShell

Little utility I made to check a list of URLs, their SSL certs, including any URLs they redirect to. The entire certificate chain for each host is also downloaded into %temp%\SslCerts folder Script source files can be downloaded here:!Aj0HCnRwyKPhge1bfpIYIlTJ6IugVQContinue reading

Posted in .NET, PowerShell | Tagged , | Leave a comment

Case of the Missing Printer Ports

A Citrix environment had both Windows Server 2008 R2 published desktops and Windows 7 SP1  VDIs On the Windows 7 VDIs the ports tab on printers added via a print server was always empty. We did a quick comparison between … Continue reading

Posted in API Monitor, Citrix, PowerShell, WinDbg | Tagged | Leave a comment

Retrieve Time Machine Password Last Reset via PowerShell

In diagnosing a machine lockout issue I wanted to find the time that: Machine Password was last set in Active Directory Machine Password was last set locally By default when a machine has a healthy connection to Active Directory you … Continue reading

Posted in .NET, Active Directory, PowerShell | Tagged | Leave a comment