Windows: Get rid of Set-Attr in remaining modules (#23525)

Only a few more modules were using Set-Attr on the $result object rather
than using a normal hashtable. This PR changes the PSObject to a
hashtable and gets rid of Set-Attr.
This commit is contained in:
Dag Wieers 2017-04-13 20:34:33 +02:00 committed by Matt Davis
commit 246c84b92a
7 changed files with 37 additions and 31 deletions

View file

@ -214,8 +214,9 @@ Function SetPrivilegeTokens() {
$params = Parse-Args $args;
$result = New-Object PSObject;
Set-Attr $result "changed" $false;
$result = @{
changed = $false
}
$path = Get-Attr $params "path" -failifempty $true
$user = Get-Attr $params "user" -failifempty $true
@ -314,7 +315,7 @@ Try {
Try {
$objACL.AddAccessRule($objACE)
Set-ACL $path $objACL
Set-Attr $result "changed" $true;
$result.changed = $true
}
Catch {
Fail-Json $result "an exception occurred when adding the specified rule - $($_.Exception.Message)"
@ -324,7 +325,7 @@ Try {
Try {
$objACL.RemoveAccessRule($objACE)
Set-ACL $path $objACL
Set-Attr $result "changed" $true;
$result.changed = $true
}
Catch {
Fail-Json $result "an exception occurred when removing the specified rule - $($_.Exception.Message)"