PowerShell always uses a culture-neutral approach when you implicitly convert a date. So this does not necessarily work with your own culture....
powertips
Categories
- Free tools
- SQL Admin Toolset
- SQL Compliance Manager
- SQL Defrag Manager
- SQL Diagnostic Manager for MySQL
- SQL Diagnostic Manager for SQL Server
- SQL Diagnostic Manager Pro
- SQL Doctor
- SQL Enterprise Job Manager
- SQL Inventory Manager
- SQL Query Tuner for SQL Server
- SQL Safe Backup
- SQL Secure
- SQL Workload Analysis for SQL Server
- Uptime Infrastructure Monitor Formerly Uptime
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...
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...
Wait for Programs
PowerShell launches Windows applications asynchronously. It only waits for the console application so you should use -wait if you want to launch a...
Open Current Folder in Your Explorer
If you are stuck in the console and would like to move over to the Explorer GUI, the next line opens your current folder in an Explorer window:...
Search for Localized Keywords
Finding the appropriate command for a task is important. With a little trick, PowerShell can help you. Have a look: function ??($keywords) {...
Filter is Faster Than Include
A number of cmdlets provide two parameters that seem to work very similar: -filter and -include: Dir $env:windir -filter *.logDir $env:windir...
Use Online Help
"To ship is to choose", so the Help files provided by PowerShell are sometimes outdated. You should use their online versions if you want...
Get to know Parameter Sets
Sometimes, you may run into issues like this once you learned more about the parameters a given cmdlet supports: Get-Random -Minimum 1 -Maximum 50...
Finding Positional Parameters
Positional parameters can be great time savers as many cmdlets assign a parameter position to its most widely used parameters. This way you do not...
Finding All Background Information About Operators or Remoting
Since Get-Help accepts wild cards, you can easily list all white papers available for a specific topic. Use this to get you all topics that deal...
Sending Information to the Clipboard
Beginning with Vista, there is a new console tool called clip.exe, which copies whatever you pipe to it to your clipboard. You should try this if...
Overwriting Pre-Defined Aliases
PowerShell protects its own pre-defined aliases so you normally cannot override and redefine them. It will still work if you use the correct...
A Better more.com
Whenever you want to break up a lot of information in separate page views, you can traditionally pipe to more.com, which is an external executable....
Reading Help with Page Breaks
Help information is typically pretty extensive. If you'd like to make the information more readable, you could always pipe the result to the...
Opening PowerShell White Papers Directly
The following line opens the folder that stores all the PowerShell white papers. You can open them in your word processor or print them for future...
Discovering PowerShell Background Information
PowerShell comes with lots of white papers. However, you do not need to know the exact title of the white paper to find information about a specific...
Retrieving Event Logs Remotely
PowerShell v.2 has added remote capabilities to a number of cmdlets, including Get-EventLog. So now you are able to collect important events...
Changing Execution Policy without Admin Rights
In PowerShell v.2, a number of parameters have been added to Set-ExecutionPolicy, which allows you to change this setting without Admin privileges,...
Smart Auto-Completion
When you press Tab to auto-complete, PowerShell will look at what you have entered so far to find the most appropriate suggestion. One little known...