From bceaf96fd610fb6f9755cbd46e6de509ca6552e6 Mon Sep 17 00:00:00 2001 From: Paul Durivage Date: Thu, 19 Jun 2014 12:17:48 -0500 Subject: [PATCH] Add comments --- examples/scripts/upgrade_to_ps3.ps1 | 2 +- library/windows/win_feature.ps1 | 15 +++++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/examples/scripts/upgrade_to_ps3.ps1 b/examples/scripts/upgrade_to_ps3.ps1 index e83d7828a9..c9096b22f4 100644 --- a/examples/scripts/upgrade_to_ps3.ps1 +++ b/examples/scripts/upgrade_to_ps3.ps1 @@ -78,6 +78,6 @@ else } $FileName = $DownLoadUrl.Split('/')[-1] -download-file $downloadurl "$powershellpath\$filename" +# download-file $downloadurl "$powershellpath\$filename" ."$powershellpath\$filename" /quiet /log "C:\powershell\install.log" diff --git a/library/windows/win_feature.ps1 b/library/windows/win_feature.ps1 index 0808aafe24..698d78dfca 100644 --- a/library/windows/win_feature.ps1 +++ b/library/windows/win_feature.ps1 @@ -63,16 +63,23 @@ If ($state -eq "present") { } Elseif ($state -eq "absent") { try { - $result = Remove-WindowsFeature -Name $name + if ($restart) { + $featureresult = Remove-WindowsFeature -Name $name -Restart + } + else { + $featureresult = Remove-WindowsFeature -Name $name + } } catch { Fail-Json $result $_.Exception.Message } } -$feature_results = @() -ForEach ($item in $result.FeatureResult) { - $feature_results += New-Object psobject @{ +# Loop through results and create a hash containing details about +# each role/feature that is installed/removed +$installed_features = @() +ForEach ($item in $featureresult.FeatureResult) { + $installed_features += New-Object psobject @{ id = $item.id.ToString() display_name = $item.DisplayName message = $item.Message.ToString()