Skip to content

Files

Latest commit

 

History

History
36 lines (25 loc) · 647 Bytes

UseCmdletCorrectly.md

File metadata and controls

36 lines (25 loc) · 647 Bytes

Pattern: Incorrect use of cmdlet

Issue: -

Description

Whenever we call a command, care should be taken that it is invoked with the correct syntax and parameters.

How

Specify all mandatory parameters when calling commands.

Example of incorrect code:

Function Set-TodaysDate ()
{
	Set-Date
	...
}

Example of correct code:

Function Set-TodaysDate ()
{
	$date = Get-Date
	Set-Date -Date $date
	...
}

Further Reading