From c0043d4ba96f459c994bc83d4e3cb912cf5d761d Mon Sep 17 00:00:00 2001 From: Simon Heather Date: Thu, 25 Apr 2019 09:28:44 +0100 Subject: [PATCH] PSScriptAnalyzer Fixes --- .../MSFT_EnvironmentResource.psm1 | 32 ++++++++---- .../MSFT_GroupResource.psm1 | 45 ++++++++++++++++ .../MSFT_MsiPackage/MSFT_MsiPackage.psm1 | 32 ++++++++++++ .../MSFT_RegistryResource.psm1 | 13 +++++ .../MSFT_ServiceResource.psm1 | 24 +++++++++ .../MSFT_UserResource/MSFT_UserResource.psm1 | 52 ++++++++++++++++++- .../MSFT_WindowsFeature.psm1 | 11 ++++ .../MSFT_WindowsOptionalFeature.psm1 | 11 ++++ .../MSFT_WindowsPackageCab.psm1 | 3 ++ .../MSFT_WindowsProcess.psm1 | 18 +++++++ 10 files changed, 229 insertions(+), 12 deletions(-) diff --git a/DscResources/MSFT_EnvironmentResource/MSFT_EnvironmentResource.psm1 b/DscResources/MSFT_EnvironmentResource/MSFT_EnvironmentResource.psm1 index 1d4603a..115bc2a 100644 --- a/DscResources/MSFT_EnvironmentResource/MSFT_EnvironmentResource.psm1 +++ b/DscResources/MSFT_EnvironmentResource/MSFT_EnvironmentResource.psm1 @@ -38,6 +38,7 @@ function Get-TargetResource [String] $Name, + [Parameter()] [ValidateSet('Process', 'Machine')] [ValidateNotNullOrEmpty()] [String[]] @@ -47,7 +48,7 @@ function Get-TargetResource $valueToReturn = $null if ($Target -contains 'Machine') - { + { $environmentVaraible = Get-EnvironmentVariableWithoutExpanding -Name $Name -ErrorAction 'SilentlyContinue' if ($null -ne $environmentVaraible) @@ -67,9 +68,9 @@ function Get-TargetResource } if ($null -eq $valueToReturn) - { + { Write-Verbose -Message ($script:localizedData.EnvVarNotFound -f $Name) - } + } else { Write-Verbose -Message ($script:localizedData.EnvVarFound -f $Name, $valueToReturn) @@ -122,17 +123,21 @@ function Set-TargetResource [String] $Name, + [Parameter()] [ValidateNotNull()] [String] $Value = [String]::Empty, + [Parameter()] [ValidateSet('Present', 'Absent')] [String] $Ensure = 'Present', + [Parameter()] [Boolean] $Path = $false, + [Parameter()] [ValidateSet('Process', 'Machine')] [ValidateNotNullOrEmpty()] [String[]] @@ -192,7 +197,6 @@ function Set-TargetResource if ($createMachineVariable -and $createProcessVariable) { - if (-not $valueSpecified) { <# @@ -430,17 +434,21 @@ function Test-TargetResource [String] $Name, + [Parameter()] [ValidateNotNull()] [String] $Value, + [Parameter()] [ValidateSet('Present', 'Absent')] [String] $Ensure = 'Present', + [Parameter()] [Boolean] $Path = $false, + [Parameter()] [ValidateSet('Process', 'Machine')] [ValidateNotNullOrEmpty()] [String[]] @@ -525,9 +533,9 @@ function Test-TargetResource # If the control reaches here, the expected environment variable exists, it is a path variable and a $Value is specified to test against if ($Ensure -eq 'Present') - { + { if ($checkMachineTarget) - { + { if (-not (Test-PathsInValue -ExistingPaths $currentValueFromMachine -QueryPaths $Value -FindCriteria 'All')) { # If the control reached here some part of the specified path ($Value) was not found in the existing variable, return failure @@ -693,8 +701,8 @@ function Add-PathsToValue $currentPaths = $CurrentValue -split ';' $newPaths = $NewValue -split ';' - foreach ($path in $newPaths) - { + foreach ($path in $newPaths) + { if ($currentPaths -notcontains $path) { <# @@ -703,8 +711,8 @@ function Add-PathsToValue #> $finalValue += ($path + ';') - } - } + } + } # Remove any extraneous ';' at the end (and potentially start - as a side-effect) of the value to be set return $finalValue.Trim(';') @@ -803,6 +811,7 @@ function Set-EnvironmentVariable [String] $Name, + [Parameter()] [String] $Value, @@ -931,6 +940,7 @@ function Set-ProcessEnvironmentVariable [String] $Name, + [Parameter()] [String] $Value = [String]::Empty ) @@ -1023,7 +1033,7 @@ function Test-PathsInValue 'Any' { foreach ($queryPath in $queryPathList) - { + { if ($existingPathList -contains $queryPath) { # Found this $queryPath in the existing paths, return $true diff --git a/DscResources/MSFT_GroupResource/MSFT_GroupResource.psm1 b/DscResources/MSFT_GroupResource/MSFT_GroupResource.psm1 index 8dfcff0..9d30be9 100644 --- a/DscResources/MSFT_GroupResource/MSFT_GroupResource.psm1 +++ b/DscResources/MSFT_GroupResource/MSFT_GroupResource.psm1 @@ -96,6 +96,7 @@ function Get-TargetResource [String] $GroupName, + [Parameter()] [System.Management.Automation.PSCredential] [System.Management.Automation.Credential()] $Credential @@ -188,22 +189,28 @@ function Set-TargetResource [String] $GroupName, + [Parameter()] [ValidateSet('Present', 'Absent')] [String] $Ensure = 'Present', + [Parameter()] [String] $Description, + [Parameter()] [String[]] $Members, + [Parameter()] [String[]] $MembersToInclude, + [Parameter()] [String[]] $MembersToExclude, + [Parameter()] [ValidateNotNullOrEmpty()] [System.Management.Automation.PSCredential] [System.Management.Automation.Credential()] @@ -286,22 +293,28 @@ function Test-TargetResource [String] $GroupName, + [Parameter()] [ValidateSet('Present', 'Absent')] [String] $Ensure = 'Present', + [Parameter()] [String] $Description, + [Parameter()] [String[]] $Members, + [Parameter()] [String[]] $MembersToInclude, + [Parameter()] [String[]] $MembersToExclude, + [Parameter()] [ValidateNotNullOrEmpty()] [System.Management.Automation.PSCredential] [System.Management.Automation.Credential()] @@ -343,6 +356,7 @@ function Get-TargetResourceOnFullSKU [String] $GroupName, + [Parameter()] [System.Management.Automation.PSCredential] [System.Management.Automation.Credential()] $Credential @@ -411,6 +425,7 @@ function Get-TargetResourceOnNanoServer [String] $GroupName, + [Parameter()] [System.Management.Automation.PSCredential] [System.Management.Automation.Credential()] $Credential @@ -508,22 +523,28 @@ function Set-TargetResourceOnFullSKU [String] $GroupName, + [Parameter()] [ValidateSet('Present', 'Absent')] [String] $Ensure = 'Present', + [Parameter()] [String] $Description, + [Parameter()] [String[]] $Members, + [Parameter()] [String[]] $MembersToInclude, + [Parameter()] [String[]] $MembersToExclude, + [Parameter()] [ValidateNotNullOrEmpty()] [System.Management.Automation.PSCredential] [System.Management.Automation.Credential()] @@ -859,22 +880,28 @@ function Set-TargetResourceOnNanoServer [String] $GroupName, + [Parameter()] [ValidateSet('Present', 'Absent')] [String] $Ensure = 'Present', + [Parameter()] [String] $Description, + [Parameter()] [String[]] $Members, + [Parameter()] [String[]] $MembersToInclude, + [Parameter()] [String[]] $MembersToExclude, + [Parameter()] [ValidateNotNullOrEmpty()] [System.Management.Automation.PSCredential] [System.Management.Automation.Credential()] @@ -1092,22 +1119,28 @@ function Test-TargetResourceOnFullSKU [String] $GroupName, + [Parameter()] [ValidateSet('Present', 'Absent')] [String] $Ensure = 'Present', + [Parameter()] [String] $Description, + [Parameter()] [String[]] $Members, + [Parameter()] [String[]] $MembersToInclude, + [Parameter()] [String[]] $MembersToExclude, + [Parameter()] [ValidateNotNullOrEmpty()] [System.Management.Automation.PSCredential] [System.Management.Automation.Credential()] @@ -1353,22 +1386,28 @@ function Test-TargetResourceOnNanoServer [String] $GroupName, + [Parameter()] [ValidateSet('Present', 'Absent')] [String] $Ensure = 'Present', + [Parameter()] [String] $Description, + [Parameter()] [String[]] $Members, + [Parameter()] [String[]] $MembersToInclude, + [Parameter()] [String[]] $MembersToExclude, + [Parameter()] [ValidateNotNullOrEmpty()] [System.Management.Automation.PSCredential] [System.Management.Automation.Credential()] @@ -1571,6 +1610,7 @@ function Get-MembersOnFullSKU [AllowEmptyCollection()] $Disposables, + [Parameter()] [System.Management.Automation.PSCredential] [System.Management.Automation.Credential()] $Credential @@ -1656,6 +1696,7 @@ function Get-MembersAsPrincipalsList [AllowEmptyCollection()] $Disposables, + [Parameter()] [System.Management.Automation.PSCredential] [System.Management.Automation.Credential()] $Credential @@ -1833,6 +1874,7 @@ function ConvertTo-UniquePrincipalsList [AllowEmptyCollection()] $Disposables, + [Parameter()] [System.Management.Automation.PSCredential] [System.Management.Automation.Credential()] $Credential @@ -1922,6 +1964,7 @@ function ConvertTo-Principal [AllowEmptyCollection()] $Disposables, + [Parameter()] [System.Management.Automation.PSCredential] [System.Management.Automation.Credential()] $Credential @@ -2007,6 +2050,7 @@ function Resolve-SidToPrincipal [System.DirectoryServices.AccountManagement.PrincipalContext] $PrincipalContext, + [Parameter()] [Parameter(Mandatory = $true)] [String] $Scope @@ -2329,6 +2373,7 @@ function Find-Principal [String] $IdentityValue, + [Parameter()] [System.DirectoryServices.AccountManagement.IdentityType] $IdentityType ) diff --git a/DscResources/MSFT_MsiPackage/MSFT_MsiPackage.psm1 b/DscResources/MSFT_MsiPackage/MSFT_MsiPackage.psm1 index b7743ba..145ce96 100644 --- a/DscResources/MSFT_MsiPackage/MSFT_MsiPackage.psm1 +++ b/DscResources/MSFT_MsiPackage/MSFT_MsiPackage.psm1 @@ -130,36 +130,46 @@ function Set-TargetResource [String] $Path, + [Parameter()] [ValidateSet('Present', 'Absent')] [String] $Ensure = 'Present', + [Parameter()] [String] $Arguments, + [Parameter()] [PSCredential] [System.Management.Automation.Credential()] $Credential, + [Parameter()] [String] $LogPath, + [Parameter()] [String] $FileHash, + [Parameter()] [ValidateSet('SHA1', 'SHA256', 'SHA384', 'SHA512', 'MD5', 'RIPEMD160')] [String] $HashAlgorithm = 'SHA256', + [Parameter()] [String] $SignerSubject, + [Parameter()] [String] $SignerThumbprint, + [Parameter()] [String] $ServerCertificateValidationCallback, + [Parameter()] [System.Management.Automation.PSCredential] [System.Management.Automation.CredentialAttribute()] $RunAsCredential @@ -411,36 +421,46 @@ function Test-TargetResource [String] $Path, + [Parameter()] [ValidateSet('Present', 'Absent')] [String] $Ensure = 'Present', + [Parameter()] [String] $Arguments, + [Parameter()] [PSCredential] [System.Management.Automation.Credential()] $Credential, + [Parameter()] [String] $LogPath, + [Parameter()] [String] $FileHash, + [Parameter()] [ValidateSet('SHA1', 'SHA256', 'SHA384', 'SHA512', 'MD5', 'RIPEMD160')] [String] $HashAlgorithm = 'SHA256', + [Parameter()] [String] $SignerSubject, + [Parameter()] [String] $SignerThumbprint, + [Parameter()] [String] $ServerCertificateValidationCallback, + [Parameter()] [System.Management.Automation.PSCredential] [System.Management.Automation.CredentialAttribute()] $RunAsCredential @@ -748,6 +768,7 @@ function Get-WebRequestResponse [Uri] $Uri, + [Parameter()] [String] $ServerCertificateValidationCallback ) @@ -941,15 +962,19 @@ function Assert-FileValid [String] $Path, + [Parameter()] [String] $FileHash, + [Parameter()] [String] $HashAlgorithm = 'SHA256', + [Parameter()] [String] $SignerThumbprint, + [Parameter()] [String] $SignerSubject ) @@ -992,6 +1017,7 @@ function Assert-FileHashValid [String] $Hash, + [Parameter()] [String] $Algorithm = 'SHA256' ) @@ -1028,9 +1054,11 @@ function Assert-FileSignatureValid [String] $Path, + [Parameter()] [String] $Thumbprint, + [Parameter()] [String] $Subject ) @@ -1098,16 +1126,20 @@ function Start-MsiProcess [String] $Path, + [Parameter()] [ValidateSet('Present', 'Absent')] [String] $Ensure = 'Present', + [Parameter()] [String] $Arguments, + [Parameter()] [String] $LogPath, + [Parameter()] [System.Management.Automation.PSCredential] [System.Management.Automation.CredentialAttribute()] $RunAsCredential diff --git a/DscResources/MSFT_RegistryResource/MSFT_RegistryResource.psm1 b/DscResources/MSFT_RegistryResource/MSFT_RegistryResource.psm1 index 9dcb566..2520083 100644 --- a/DscResources/MSFT_RegistryResource/MSFT_RegistryResource.psm1 +++ b/DscResources/MSFT_RegistryResource/MSFT_RegistryResource.psm1 @@ -53,9 +53,11 @@ function Get-TargetResource [AllowEmptyString()] $ValueName, + [Parameter()] [String[]] $ValueData, + [Parameter()] [ValidateSet('String', 'Binary', 'DWord', 'QWord', 'MultiString', 'ExpandString')] [String] $ValueType @@ -190,21 +192,26 @@ function Set-TargetResource [AllowEmptyString()] $ValueName, + [Parameter()] [ValidateSet('Present', 'Absent')] [String] $Ensure = 'Present', + [Parameter()] [ValidateNotNull()] [String[]] $ValueData = @(), + [Parameter()] [ValidateSet('String', 'Binary', 'DWord', 'QWord', 'MultiString', 'ExpandString')] [String] $ValueType = 'String', + [Parameter()] [Boolean] $Hex = $false, + [Parameter()] [Boolean] $Force = $false ) @@ -394,21 +401,26 @@ function Test-TargetResource [String] $ValueName, + [Parameter()] [ValidateSet('Present', 'Absent')] [String] $Ensure = 'Present', + [Parameter()] [ValidateNotNull()] [String[]] $ValueData = @(), + [Parameter()] [ValidateSet('String', 'Binary', 'DWord', 'QWord', 'MultiString', 'ExpandString')] [String] $ValueType = 'String', + [Parameter()] [Boolean] $Hex = $false, + [Parameter()] [Boolean] $Force = $false ) @@ -735,6 +747,7 @@ function Get-RegistryKey [String] $RegistryKeyPath, + [Parameter()] [Switch] $WriteAccessAllowed ) diff --git a/DscResources/MSFT_ServiceResource/MSFT_ServiceResource.psm1 b/DscResources/MSFT_ServiceResource/MSFT_ServiceResource.psm1 index bad4712..8cea484 100644 --- a/DscResources/MSFT_ServiceResource/MSFT_ServiceResource.psm1 +++ b/DscResources/MSFT_ServiceResource/MSFT_ServiceResource.psm1 @@ -182,47 +182,59 @@ function Set-TargetResource [String] $Name, + [Parameter()] [ValidateSet('Present', 'Absent')] [String] $Ensure = 'Present', + [Parameter()] [ValidateNotNullOrEmpty()] [String] $Path, + [Parameter()] [ValidateSet('Automatic', 'Manual', 'Disabled')] [String] $StartupType, + [Parameter()] [ValidateSet('LocalSystem', 'LocalService', 'NetworkService')] [String] $BuiltInAccount, + [Parameter()] [ValidateSet('Running', 'Stopped', 'Ignore')] [String] $State = 'Running', + [Parameter()] [Boolean] $DesktopInteract = $false, + [Parameter()] [ValidateNotNullOrEmpty()] [String] $DisplayName, + [Parameter()] [ValidateNotNullOrEmpty()] [String] $Description, + [Parameter()] [String[]] [AllowEmptyCollection()] $Dependencies, + [Parameter()] [UInt32] $StartupTimeout = 30000, + [Parameter()] [UInt32] $TerminateTimeout = 30000, + [Parameter()] [ValidateNotNull()] [System.Management.Automation.PSCredential] [System.Management.Automation.Credential()] @@ -393,47 +405,59 @@ function Test-TargetResource [String] $Name, + [Parameter()] [ValidateSet('Present', 'Absent')] [String] $Ensure = 'Present', + [Parameter()] [ValidateNotNullOrEmpty()] [String] $Path, + [Parameter()] [ValidateSet('Automatic', 'Manual', 'Disabled')] [String] $StartupType, + [Parameter()] [ValidateSet('LocalSystem', 'LocalService', 'NetworkService')] [String] $BuiltInAccount, + [Parameter()] [Boolean] $DesktopInteract = $false, + [Parameter()] [ValidateSet('Running', 'Stopped', 'Ignore')] [String] $State = 'Running', + [Parameter()] [ValidateNotNull()] [String] $DisplayName, + [Parameter()] [String] [AllowEmptyString()] $Description, + [Parameter()] [String[]] [AllowEmptyCollection()] $Dependencies, + [Parameter()] [UInt32] $StartupTimeout = 30000, + [Parameter()] [UInt32] $TerminateTimeout = 30000, + [Parameter()] [ValidateNotNull()] [System.Management.Automation.PSCredential] [System.Management.Automation.Credential()] diff --git a/DscResources/MSFT_UserResource/MSFT_UserResource.psm1 b/DscResources/MSFT_UserResource/MSFT_UserResource.psm1 index 0c65fe4..28686b8 100644 --- a/DscResources/MSFT_UserResource/MSFT_UserResource.psm1 +++ b/DscResources/MSFT_UserResource/MSFT_UserResource.psm1 @@ -104,30 +104,38 @@ function Set-TargetResource [String] $UserName, + [Parameter()] [ValidateSet('Present', 'Absent')] [String] $Ensure = 'Present', + [Parameter()] [String] $FullName, + [Parameter()] [String] $Description, + [Parameter()] [ValidateNotNullOrEmpty()] [System.Management.Automation.PSCredential] [System.Management.Automation.Credential()] $Password, + [Parameter()] [Boolean] $Disabled, + [Parameter()] [Boolean] $PasswordNeverExpires, + [Parameter()] [Boolean] $PasswordChangeRequired, + [Parameter()] [Boolean] $PasswordChangeNotAllowed ) @@ -187,30 +195,38 @@ function Test-TargetResource [String] $UserName, + [Parameter()] [ValidateSet('Present', 'Absent')] [String] $Ensure = 'Present', + [Parameter()] [String] $FullName, + [Parameter()] [String] $Description, + [Parameter()] [ValidateNotNullOrEmpty()] [System.Management.Automation.PSCredential] [System.Management.Automation.Credential()] $Password, + [Parameter()] [Boolean] $Disabled, + [Parameter()] [Boolean] $PasswordNeverExpires, + [Parameter()] [Boolean] $PasswordChangeRequired, + [Parameter()] [Boolean] $PasswordChangeNotAllowed ) @@ -343,30 +359,38 @@ function Set-TargetResourceOnFullSKU [String] $UserName, + [Parameter()] [ValidateSet('Present', 'Absent')] [String] $Ensure = 'Present', + [Parameter()] [String] $FullName, + [Parameter()] [String] $Description, + [Parameter()] [ValidateNotNullOrEmpty()] [System.Management.Automation.PSCredential] [System.Management.Automation.Credential()] $Password, + [Parameter()] [Boolean] $Disabled, + [Parameter()] [Boolean] $PasswordNeverExpires, + [Parameter()] [Boolean] $PasswordChangeRequired, + [Parameter()] [Boolean] $PasswordChangeNotAllowed ) @@ -559,30 +583,38 @@ function Test-TargetResourceOnFullSKU [String] $UserName, + [Parameter()] [ValidateSet('Present', 'Absent')] [String] $Ensure = 'Present', + [Parameter()] [String] $FullName, + [Parameter()] [String] $Description, + [Parameter()] [ValidateNotNullOrEmpty()] [System.Management.Automation.PSCredential] [System.Management.Automation.Credential()] $Password, + [Parameter()] [Boolean] $Disabled, + [Parameter()] [Boolean] $PasswordNeverExpires, + [Parameter()] [Boolean] $PasswordChangeRequired, + [Parameter()] [Boolean] $PasswordChangeNotAllowed ) @@ -703,7 +735,7 @@ function Get-TargetResourceOnNanoServer [CmdletBinding()] param ( - [parameter(Mandatory = $true)] + [Parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] [String] $UserName @@ -807,30 +839,38 @@ function Set-TargetResourceOnNanoServer [String] $UserName, + [Parameter()] [ValidateSet('Present', 'Absent')] [String] $Ensure = 'Present', + [Parameter()] [String] $FullName, + [Parameter()] [String] $Description, + [Parameter()] [ValidateNotNullOrEmpty()] [System.Management.Automation.PSCredential] [System.Management.Automation.Credential()] $Password, + [Parameter()] [Boolean] $Disabled, + [Parameter()] [Boolean] $PasswordNeverExpires, + [Parameter()] [Boolean] $PasswordChangeRequired, + [Parameter()] [Boolean] $PasswordChangeNotAllowed ) @@ -1000,30 +1040,38 @@ function Test-TargetResourceOnNanoServer [String] $UserName, + [Parameter()] [ValidateSet('Present', 'Absent')] [String] $Ensure = 'Present', + [Parameter()] [String] $FullName, + [Parameter()] [String] $Description, + [Parameter()] [ValidateNotNullOrEmpty()] [System.Management.Automation.PSCredential] [System.Management.Automation.Credential()] $Password, + [Parameter()] [Boolean] $Disabled, + [Parameter()] [Boolean] $PasswordNeverExpires, + [Parameter()] [Boolean] $PasswordChangeRequired, + [Parameter()] [Boolean] $PasswordChangeNotAllowed ) @@ -1178,6 +1226,7 @@ function Test-CredentialsValidOnNanoServer [String] $UserName, + [Parameter()] [ValidateNotNullOrEmpty()] [SecureString] $Password @@ -1522,6 +1571,7 @@ function Remove-DisposableObject [CmdletBinding()] param ( + [Parameter()] [System.Collections.ArrayList] [AllowEmptyCollection()] $Disposables diff --git a/DscResources/MSFT_WindowsFeature/MSFT_WindowsFeature.psm1 b/DscResources/MSFT_WindowsFeature/MSFT_WindowsFeature.psm1 index 0fd5e80..a0626e0 100644 --- a/DscResources/MSFT_WindowsFeature/MSFT_WindowsFeature.psm1 +++ b/DscResources/MSFT_WindowsFeature/MSFT_WindowsFeature.psm1 @@ -39,6 +39,7 @@ function Get-TargetResource [String] $Name, + [Parameter()] [ValidateNotNullOrEmpty()] [System.Management.Automation.PSCredential] [System.Management.Automation.Credential()] @@ -169,18 +170,22 @@ function Set-TargetResource [String] $Name, + [Parameter()] [ValidateSet('Present', 'Absent')] [String] $Ensure = 'Present', + [Parameter()] [Boolean] $IncludeAllSubFeature = $false, + [Parameter()] [ValidateNotNullOrEmpty()] [System.Management.Automation.PSCredential] [System.Management.Automation.Credential()] $Credential, + [Parameter()] [ValidateNotNullOrEmpty()] [String] $LogPath @@ -339,18 +344,22 @@ function Test-TargetResource [String] $Name, + [Parameter()] [ValidateSet('Present', 'Absent')] [String] $Ensure = 'Present', + [Parameter()] [Boolean] $IncludeAllSubFeature = $false, + [Parameter()] [ValidateNotNullOrEmpty()] [System.Management.Automation.PSCredential] [System.Management.Automation.Credential()] $Credential, + [Parameter()] [ValidateNotNullOrEmpty()] [String] $LogPath @@ -466,9 +475,11 @@ function Assert-SingleFeatureExists [CmdletBinding()] param ( + [Parameter()] [PSObject] $Feature, + [Parameter()] [String] $Name ) diff --git a/DscResources/MSFT_WindowsOptionalFeature/MSFT_WindowsOptionalFeature.psm1 b/DscResources/MSFT_WindowsOptionalFeature/MSFT_WindowsOptionalFeature.psm1 index 7acb4da..816c31d 100644 --- a/DscResources/MSFT_WindowsOptionalFeature/MSFT_WindowsOptionalFeature.psm1 +++ b/DscResources/MSFT_WindowsOptionalFeature/MSFT_WindowsOptionalFeature.psm1 @@ -109,19 +109,24 @@ function Set-TargetResource [String] $Name, + [Parameter()] [ValidateSet('Present', 'Absent')] [String] $Ensure = 'Present', + [Parameter()] [Boolean] $RemoveFilesOnDisable, + [Parameter()] [Boolean] $NoWindowsUpdateCheck, + [Parameter()] [String] $LogPath, + [Parameter()] [ValidateSet('ErrorsOnly', 'ErrorsAndWarning', 'ErrorsAndWarningAndInformation')] [String] $LogLevel = 'ErrorsAndWarningAndInformation' @@ -237,19 +242,24 @@ function Test-TargetResource [String] $Name, + [Parameter()] [ValidateSet('Present', 'Absent')] [String] $Ensure = 'Present', + [Parameter()] [Boolean] $RemoveFilesOnDisable, + [Parameter()] [Boolean] $NoWindowsUpdateCheck, + [Parameter()] [String] $LogPath, + [Parameter()] [ValidateSet('ErrorsOnly', 'ErrorsAndWarning', 'ErrorsAndWarningAndInformation')] [String] $LogLevel = 'ErrorsAndWarningAndInformation' @@ -291,6 +301,7 @@ function Convert-CustomPropertyArrayToStringArray [OutputType([String[]])] param ( + [Parameter()] [PSCustomObject[]] $CustomProperties ) diff --git a/DscResources/MSFT_WindowsPackageCab/MSFT_WindowsPackageCab.psm1 b/DscResources/MSFT_WindowsPackageCab/MSFT_WindowsPackageCab.psm1 index a4e49c7..111e483 100644 --- a/DscResources/MSFT_WindowsPackageCab/MSFT_WindowsPackageCab.psm1 +++ b/DscResources/MSFT_WindowsPackageCab/MSFT_WindowsPackageCab.psm1 @@ -48,6 +48,7 @@ function Get-TargetResource [String] $SourcePath, + [Parameter()] [ValidateNotNullOrEmpty()] [String] $LogPath @@ -130,6 +131,7 @@ function Set-TargetResource [String] $SourcePath, + [Parameter()] [ValidateNotNullOrEmpty()] [String] $LogPath @@ -196,6 +198,7 @@ function Test-TargetResource [String] $SourcePath, + [Parameter()] [ValidateNotNullOrEmpty()] [String] $LogPath diff --git a/DscResources/MSFT_WindowsProcess/MSFT_WindowsProcess.psm1 b/DscResources/MSFT_WindowsProcess/MSFT_WindowsProcess.psm1 index 3b4eb01..8ce5396 100644 --- a/DscResources/MSFT_WindowsProcess/MSFT_WindowsProcess.psm1 +++ b/DscResources/MSFT_WindowsProcess/MSFT_WindowsProcess.psm1 @@ -46,6 +46,7 @@ function Get-TargetResource [String] $Arguments, + [Parameter()] [ValidateNotNullOrEmpty()] [System.Management.Automation.PSCredential] [System.Management.Automation.Credential()] @@ -159,24 +160,30 @@ function Set-TargetResource [String] $Arguments, + [Parameter()] [ValidateNotNullOrEmpty()] [System.Management.Automation.PSCredential] [System.Management.Automation.Credential()] $Credential, + [Parameter()] [ValidateSet('Present', 'Absent')] [String] $Ensure = 'Present', + [Parameter()] [String] $StandardOutputPath, + [Parameter()] [String] $StandardErrorPath, + [Parameter()] [String] $StandardInputPath, + [Parameter()] [String] $WorkingDirectory ) @@ -436,24 +443,30 @@ function Test-TargetResource [String] $Arguments, + [Parameter()] [ValidateNotNullOrEmpty()] [PSCredential] [System.Management.Automation.Credential()] $Credential, + [Parameter()] [ValidateSet('Present', 'Absent')] [String] $Ensure = 'Present', + [Parameter()] [String] $StandardOutputPath, + [Parameter()] [String] $StandardErrorPath, + [Parameter()] [String] $StandardInputPath, + [Parameter()] [String] $WorkingDirectory ) @@ -562,14 +575,17 @@ function Get-ProcessCimInstance [String] $Path, + [Parameter()] [String] $Arguments, + [Parameter()] [ValidateNotNullOrEmpty()] [System.Management.Automation.PSCredential] [System.Management.Automation.Credential()] $Credential, + [Parameter()] [ValidateRange(0, [Int]::MaxValue)] [Int] $UseGetCimInstanceThreshold = 8 @@ -748,6 +764,7 @@ function Get-ArgumentsFromCommandLineInput [CmdletBinding()] param ( + [Parameter()] [String] $CommandLineInput ) @@ -844,6 +861,7 @@ function Wait-ProcessCount [Int] $ProcessCount, + [Parameter()] [Int] $WaitTime = 200000 )