|
1 |
| -#Requires -RunAsAdministrator |
| 1 | +#Requires -RunAsAdministrator |
2 | 2 | function Edit-SignedWDACConfig {
|
3 | 3 | [CmdletBinding(
|
4 | 4 | DefaultParameterSetName = 'Allow New Apps Audit Events',
|
@@ -256,7 +256,7 @@ function Edit-SignedWDACConfig {
|
256 | 256 | # The notice about variable being assigned and never used should be ignored - it's being dot-sourced from Resources file
|
257 | 257 | [datetime]$Date = Get-Date
|
258 | 258 | # An empty array that holds the Policy XML files - This array will eventually be used to create the final Supplemental policy
|
259 |
| - [System.Array]$PolicyXMLFilesArray = @() |
| 259 | + [System.Object[]]$PolicyXMLFilesArray = @() |
260 | 260 |
|
261 | 261 | ################################### Initiate Live Audit Mode ###################################
|
262 | 262 |
|
@@ -333,9 +333,9 @@ CiTool --update-policy "$((Get-Location).Path)\$PolicyID.cip" -json; Remove-Item
|
333 | 333 | &$WritePink "`nAudit mode deployed, start installing your programs now"
|
334 | 334 | &$WriteViolet "When you've finished installing programs, Press Enter to start selecting program directories to scan`n"
|
335 | 335 | Pause
|
336 |
| - |
| 336 | + |
337 | 337 | # Store the program paths that user browses for in an array
|
338 |
| - [System.Array]$ProgramsPaths = @() |
| 338 | + [System.Object[]]$ProgramsPaths = @() |
339 | 339 | Write-Host "`nSelect program directories to scan" -ForegroundColor Cyan
|
340 | 340 | # Showing folder picker GUI to the user for folder path selection
|
341 | 341 | do {
|
@@ -469,7 +469,7 @@ CiTool --update-policy "$((Get-Location).Path)\$PolicyID.cip" -json; Remove-Item
|
469 | 469 | # Any other attempts such as "Get-FileHash" or "Get-AuthenticodeSignature" fail and ConfigCI Module cmdlets totally ignore these files and do not create allow rules for them
|
470 | 470 |
|
471 | 471 | # Finding the file(s) first and storing them in an array
|
472 |
| - [System.Array]$ExesWithNoHash = @() |
| 472 | + [System.Object[]]$ExesWithNoHash = @() |
473 | 473 | # looping through each user-selected path(s)
|
474 | 474 | foreach ($ProgramsPath in $ProgramsPaths) {
|
475 | 475 | # Making sure the currently processing path has any .exe in it
|
@@ -621,7 +621,7 @@ CiTool --update-policy "$((Get-Location).Path)\$PolicyID.cip" -json; Remove-Item
|
621 | 621 | Remove-Item -Path '.\ProgramDir_ScanResults*.xml' -Force -ErrorAction SilentlyContinue
|
622 | 622 | Remove-Item -Path ".\SupplementalPolicy$SuppPolicyName.xml" -Force -ErrorAction SilentlyContinue
|
623 | 623 | # An empty array that holds the Policy XML files - This array will eventually be used to create the final Supplemental policy
|
624 |
| - [System.Array]$PolicyXMLFilesArray = @() |
| 624 | + [System.Object[]]$PolicyXMLFilesArray = @() |
625 | 625 |
|
626 | 626 | #Initiate Live Audit Mode
|
627 | 627 |
|
@@ -700,7 +700,7 @@ CiTool --update-policy "$((Get-Location).Path)\$PolicyID.cip" -json; Remove-Item
|
700 | 700 | Pause
|
701 | 701 |
|
702 | 702 | # Store the program paths that user browses for in an array
|
703 |
| - [System.Array]$ProgramsPaths = @() |
| 703 | + [System.Object[]]$ProgramsPaths = @() |
704 | 704 | Write-Host "`nSelect program directories to scan`n" -ForegroundColor Cyan
|
705 | 705 | # Showing folder picker GUI to the user for folder path selection
|
706 | 706 | do {
|
@@ -910,8 +910,6 @@ CiTool --update-policy "$((Get-Location).Path)\$PolicyID.cip" -json; Remove-Item
|
910 | 910 | New-Item -Path "$env:TEMP\TemporarySignToolFile" -ItemType Directory -Force | Out-Null
|
911 | 911 | Copy-Item -Path $SignToolPathFinal -Destination "$env:TEMP\TemporarySignToolFile" -Force
|
912 | 912 | New-CIPolicy -ScanPath "$env:TEMP\TemporarySignToolFile" -Level FilePublisher -Fallback Hash -UserPEs -UserWriteablePaths -MultiplePolicyFormat -AllowFileNameFallbacks -FilePath .\SignTool.xml
|
913 |
| - # Due to a bug Have to repeat this process twice: https://github.com/MicrosoftDocs/WDAC-Toolkit/issues/278 |
914 |
| - New-CIPolicy -ScanPath "$env:TEMP\TemporarySignToolFile" -Level FilePublisher -Fallback Hash -UserPEs -UserWriteablePaths -MultiplePolicyFormat -AllowFileNameFallbacks -FilePath .\SignTool.xml |
915 | 913 | # Delete the Temporary folder in the TEMP folder
|
916 | 914 | if (!$Debug) { Remove-Item -Recurse -Path "$env:TEMP\TemporarySignToolFile" -Force }
|
917 | 915 |
|
@@ -1025,6 +1023,6 @@ Can be used with any parameter to bypass the online version check - only to be u
|
1025 | 1023 | Set-PSReadLineKeyHandler -Key Tab -Function MenuComplete
|
1026 | 1024 | Register-ArgumentCompleter -CommandName 'Edit-SignedWDACConfig' -ParameterName 'CertCN' -ScriptBlock $ArgumentCompleterCertificateCN
|
1027 | 1025 | Register-ArgumentCompleter -CommandName 'Edit-SignedWDACConfig' -ParameterName 'CertPath' -ScriptBlock $ArgumentCompleterCertPath
|
1028 |
| -Register-ArgumentCompleter -CommandName 'Edit-SignedWDACConfig' -ParameterName 'SignToolPath' -ScriptBlock $ArgumentCompleterSignToolPath |
| 1026 | +Register-ArgumentCompleter -CommandName 'Edit-SignedWDACConfig' -ParameterName 'SignToolPath' -ScriptBlock $ArgumentCompleterExeFilePathsPicker |
1029 | 1027 | Register-ArgumentCompleter -CommandName 'Edit-SignedWDACConfig' -ParameterName 'PolicyPaths' -ScriptBlock $ArgumentCompleterPolicyPathsBasePoliciesOnly
|
1030 | 1028 | Register-ArgumentCompleter -CommandName 'Edit-SignedWDACConfig' -ParameterName 'SuppPolicyPaths' -ScriptBlock $ArgumentCompleterPolicyPathsSupplementalPoliciesOnly
|
0 commit comments