Powershell

Secret -Force Switch

PowerShell automatically displays all object properties when you output the object to the console. Here is an example: Get-WmiObject win32_bios...

read more

List Local Groups

If you'd like to get a list of all local Groups on your computer, you can use this line: Get-WMIObject Win32_Group -filter...

read more

Working Remotely With WMI

PowerShell v1 has no support for working remotely but WMI natively is able to work on local or remote machines. Simply use the -computername...

read more

Deleting Shares

If you'd like to get rid of a file share, such as the one you created via WMI in our last tip, this is how you can do it: (Get-WMIObject...

read more

Finding CD-ROM Drives

You can find out whether a system has CD-Drives by using a little function that returns all drive letters from all CD Drives in your system:...

read more

Cloning Objects

As a rule of thumb, PowerShell creates real copies when you copy variables. So in the next example, changing the array in $a will not affect the...

read more

Expanding Group Results

Group-Object is perfect for grouping objects based on one or more properties. Once you group objects, you can then filter, or sort, based on their...

read more

Sort With PS Code

Sort-Object is a great and versatile cmdlet to sort anything you want. Simply specify the property or properties you want to use for sorting: Dir...

read more

Splitting Text Into Words

If you ever need to read in a file and split file content into words, there are a couple of gotchas to keep in mind. First off, remember that...

read more

Passing ByRef vs. ByVal

Usually, when you assign a variable to another variable, its content is copied. Here is an example: $a = "Hello"$b = $a$a = "Hello...

read more

Ejecting CDs

PowerShell can still use COM libraries. Simply use New-Object -comObject and provide the COM library name to load it. With this approach, you can do...

read more

Deleting Aliases

As you may know aliases are shortcuts to other commands. So, you can easily add new aliases like this: Set-Alias edit notepad.exe The next time you...

read more