Skip to content

Latest commit

 

History

History
41 lines (31 loc) · 559 Bytes

UseCmdletCorrectly.md

File metadata and controls

41 lines (31 loc) · 559 Bytes
description ms.date ms.topic title
Use Cmdlet Correctly
06/28/2023
reference
UseCmdletCorrectly

UseCmdletCorrectly

Severity Level: Warning

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

Wrong

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

Correct

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