Use PowerShell Cmdlets!

Whenever possible, try to avoid raw .NET access if you would like to create more readable code. For example, the following line returns the current date:

[System.DateTime]::Now

Here is a much better approach: simply use Get-Date:

Get-Date

Remember: Raw .NET access is the last resort if no appropriate cmdlet is available.

Twitter This Tip! ReTweet this Tip!


Posted Jul 19 2010, 08:00 AM by ps1
Concentrated Tech NSoftware Dell Compellent Sponsored by Idera and Concentrated Tech and NSoftware and Dell Compellent
Copyright 2011 PowerShell.com. All rights reserved.