More PSScriptAnalyzer Fixes

This commit is contained in:
Simon Heather
2019-04-25 09:42:29 +01:00
parent c0043d4ba9
commit 28ff903ad1
4 changed files with 6 additions and 5 deletions
@@ -2105,6 +2105,7 @@ function Get-PrincipalContext
[String]
$Scope,
[Parameter()]
[System.Management.Automation.PSCredential]
[System.Management.Automation.Credential()]
$Credential,
@@ -1357,6 +1357,7 @@ function Add-UserOnFullSku
[String]
$UserName,
[Parameter()]
[ValidateNotNullOrEmpty()]
[System.Management.Automation.PSCredential]
[System.Management.Automation.Credential()]
@@ -76,7 +76,6 @@ function Get-TargetResource
{
foreach ($currentSubFeatureName in $feature.SubFeatures)
{
$getWindowsFeatureParameters = @{
Name = $currentSubFeatureName
}
@@ -531,7 +530,8 @@ function Import-ServerManager
{
Import-Module -Name 'ServerManager' -ErrorAction Stop
}
catch [System.Management.Automation.RuntimeException] {
catch [System.Management.Automation.RuntimeException]
{
if ($_.Exception.Message -like "*Some or all identity references could not be translated*")
{
Write-Verbose -Message $script:localizedData.IdentityNotFoundMessage
@@ -599,7 +599,6 @@ function Get-ProcessCimInstance
if ($getProcessResult.Count -ge $UseGetCimInstanceThreshold)
{
$escapedPathForWqlFilter = ConvertTo-EscapedStringForWqlFilter -FilterString $Path
$wqlFilter = "ExecutablePath = '$escapedPathForWqlFilter'"
@@ -1121,8 +1120,8 @@ function Assert-PsDscContextNotRunAsUser
for a user from the local system.
Currently Start-Process, which is the command used otherwise, cannot do this.
#>
function Import-DscNativeMethods
{
function Import-DscNativeMethods
{
$dscNativeMethodsSource = @"
using System;