x_notes.txt
StigFunctions
If statement: Line 256 EndBracket: Line if ($remoteExecution) { Write-Output "`t`t`tRemote STIG Checklist - $stigType" try { if (Test-Path $xccdfPath) { $remoteXccdfPath = (Copy-Item -Path $xccdfPath -Passthru -Destination "\\$machine\C$\Scar\STIG Data\Xccdfs" -Force -Confirm:$False -ErrorAction Stop).FullName.Replace("\\$machine\C$\","C:\") } $remoteCklPath = "C:\SCAR\STIG Checklists" if ('' -ne $manualCheckFile) { $remoteManualCheckFile = (Copy-Item -Path $ManualCheckFile -Passthru -Destination "\\$machine\C$\Scar\STIG Data\ManualChecks" -Force -Confirm:$False -ErrorAction Stop).FullName.Replace("\\$machine\C$\","C:\") } $remoteCklJob = Invoke-Command -ComputerName $machine -AsJob -ArgumentList $remoteXccdfPath,$remoteManualCheckFile,$remoteCklPath,$dscResult,$machineFolder,$stigType,$enclave -ScriptBlock { param( [Parameter(Position=0)]$remoteXccdfPath, [Parameter(Position=1)]$remoteManualCheckFile, [Parameter(Position=2)]$remoteCklPath, [Parameter(Position=3)]$dscResult, [Parameter(Position=4)]$machineFolder, [Parameter(Position=5)]$stigType, [Parameter(Position=5)]$enclave ) Import-Module -Name "C:\Program Files\WindowsPowershell\Modules\PowerSTIG\*\powerstig.psm1" Import-Module -Name "C:\Program Files\WindowsPowershell\Modules\StigRepo\*\module\StigRepo.psm1" $params = @{ xccdfPath = $remotexccdfPath OutputPath = "$remoteCklPath\$env:computername-$stigType.ckl" DscResult = $dscResult Enclave = $Enclave } if ('' -ne $remoteManualCheckFile) { $params += @{ManualCheckFile = $remoteManualCheckFile} } Get-StigChecklist @params -ErrorAction SilentlyContinue } $null = $remoteCklJobs.Add($remoteCklJob) } catch { Write-Output "Unable to generate STIG Checklists for $machine." } } |