Skip to content

Latest commit

 

History

History
42 lines (32 loc) · 583 Bytes

File metadata and controls

42 lines (32 loc) · 583 Bytes
description Use Cmdlet Correctly
ms.custom PSSA v1.21.0
ms.date 06/28/2023
ms.topic reference
title 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
    ...
}