Powershell

Creating Byte Arrays

You can try this to create a new empty byte array with 100 bytes: $byte = New-Object Byte[] 100   Try this if you need to create a byte array...

read more

Finding IP Addresses

Sometimes, classic tools like ipconfig.exe can yield useful information that you'd like to integrate with PowerShell. Here is sample code that...

read more

Copy Registry Hives

You can use Copy-Item to quickly copy entire structures of registry keys and sub-keys in a matter of milliseconds. Take a look at this example...

read more

RegEx Magic

The [RegEx] type has a method called Replace(), which can be used to replace text by using regular expressions. This line would replace the last...

read more

Find Dependent Services

If you would like to check the implications of stopping  a service, you should have a look at its dependent services: (Get-Service...

read more

Restart required

Check out this line to determine when an installation required a system restart: Get-EventLog -InstanceId 1038 -LogName Application | ForEach-Object...

read more

Find multiple matches

When you want to find matches based on regular expressions, PowerShell will only support the -match operator which finds the first match. There does...

read more

Find system restore points

Windows Update and Software installations will frequently create system restore points. Run this to get a list of such events: Get-EventLog -LogName...

read more

Secret history shortcut

PowerShell will keep a history of the commands you entered and then you can list the history with Get-History, configuring the maximum length of...

read more