database-tools

Get All Logged On Users

In a previous tip, you learned how to determine who the user is logged onto the physical machine. However, this will not discover logged-on terminal...

read more

Comparing Hotfixes

If you want to check hotfixes, you should compare installed hotfixes on a master image with some other machine. Go ahead and use Compare-Object and...

read more

Backing Up Event Log Files

WMI provides a method to backup event log files as *.evt/*.evtx files. The code below creates backups of all available event logs: Get-WmiObject...

read more

Checking Loaded Formats

PowerShell Snapins and Modules can add format files that describe how Powershell should auto-format object types. Use this line to check which...

read more

Checking Loaded Assemblies

Use this line to check which .NET assemblies are currently loaded into PowerShell: $host.Runspace.RunspaceConfiguration.Assemblies ReTweet this...

read more

Checking -STA Mode

PowerShell needs to run in STA mode to display Windows Presentation Foundation (WPF) windows. ISE runs in STA mode by default whereas the console...

read more

Cleaning Transcript

When you run Start-Transcript, PowerShell will document all console input and output in a file. To remove all output and create a file with your...

read more

Automated Authentication

You will not want a credential dialog to pop up if you need to run scripts unattended that need to authenticate using credentials. Here is an...

read more

Get Logged On User

You can use this code to find out which user is locally logged on a machine: $computername = 'SomeMachine-or-IP'Get-WmiObject...

read more

Finding Parameter Aliases

Sometimes, cmdlet parameters have additional alias names, but these names aren't well documented. Here is a script that will list all parameter...

read more

Formatting a Drive

In Windows Vista and higher, there is a new WMI class called Win32_Volume that you can use to format drives. However, you should be careful when...

read more

Comparing Services

Compare-Object can help when troubleshooting computers. For example, you should try this to compare the service status on two machines and find out...

read more

Reading Text Files Fast

Let's assume you want to read a large text file. Let's create one: Get-Process | Export-CliXML $home\data.xml(Dir $home\data.xml |...

read more