You can use Resolve-Path to support wildcards so you can use it to easily put together a list of file names like this: Resolve-Path...
database-tools
Adding New Virtual Drives
You do not need to use drive letters to access information provided by PowerShell providers. For example, you should use this to list the...
ExpandProperty to the Rescue
You will find that Select-Object is often used to select object properties and discard unneeded information: Get-Process | Select-Object Name,...
Open Explorer
While the PowerShell console is great, it is sometimes just easier to switch to Windows Explorer. Here is the fastest way to open Explorer and show...
Exchange 2010 Compiled Help
Want to learn about all the new Exchange 2010 cmdlets? You can download the compiled Help file from Microsoft:...
Discovering Impact Level
In a previous tip, you learned how to use $ConfirmPreference to get a warning before a cmdlet actually changes your system. This was based on the...
How ConfirmPreference works
Cmdlet authors can judge how severe the action is a cmdlet takes and choose from Low over Medium to High. You can use the variable...
Hide Error Messages
You may already know that you can suppress error messages with the ErrorAction parameter, which is often a good idea. Take a look at this and then...
Temporary File Name
Thanks to Get-Date, you can easily create unique temporary file names with a timestamp: (Get-Date -format 'yyyy-MM-dd hh-mm-ss') +...
Parameters Correspond to Columns
Many Get-*-Cmdlets, such as Get-EventLog or Get-Process, will output data in columns and support parameters named like these columns. So to filter...
Use Culture-Specific Dates!
PowerShell always uses a culture-neutral approach when you implicitly convert a date. So this does not necessarily work with your own culture....
Export CSV with Culture-Specific Delimiter
Export-CSV used to only support the comma as separator, which caused problems on non-U.S.-systems. In PowerShell v.2, with -useCulture you can have...
Stopping the Pipeline
Usually, once a pipeline runs, you cannot stop it prematurely, even if you already received the information you were seeking. Simply use this filter...
Creating Large Dummy Files With .NET
You can always resort to the underlying .NET framework whenever the functionality you need isn't available through a cmdlet. The following code...
Creating Large Dummy Files
Sometimes, it is more efficient to use existing console tools rather than PowerShell cmdlets. For example here is a way to create a large file for...
Running PowerShell Scripts as Scheduled Task
If you have jobs that need to execute regularly, you can manage them with a PowerShell script and make it a scheduled task: schtasks /CREATE /TN...
Launching a PowerShell Script Externally
To launch a PowerShell script outside of the PowerShell console (i.e. as scheduled task or as a link), prepend the script path with this:...
Accessing Profile Scripts
Profile scripts are executed automatically when PowerShell starts. The paths to these scripts can be found in $profile: $profile | gm *Host* | % {...
Listing Execution Policies
In PowerShell v.2, there are multiple execution policies. You should use this to view and check the settings: Get-ExecutionPolicy -List ReTweet this...
Closing a Program Gracefully
When you use Stop-Process to kill a program, it will stop instantaneously. The user will get no chance to save unsaved documents: Get-Process...
Stopping a Program Whenever You Feel Like It
When you launch a program using Start-Process with -passThru, you will get back the process object representing the started program. You can then...
Use CHOICE to Prompt for Input
PowerShell can run native console applications, which can be very helpful. For example, you should take a closer look at CHOICE.EXE, which will...
Archive Alternative Methods
We have been looking at how Uptime stores its data and how me can make better use of Uptime.With the exception of the disk performance_fscap table...
Launching Programs Maximized
Start-Process has a parameter called -WindowStyle. With it, you can control the window size of the application you launch. You should use this line...