我有一堆单独的脚本来构建基于每周 Nessus 扫描的各种报告。在每个单独的脚本中,我执行以下操作:
Function Get-FileName($initialDirectory)
{
[System.Reflection.Assembly]::LoadWithPartialName("System.windows.forms") | Out-Null
$OpenFileDialog = New-Object System.Windows.Forms.OpenFileDialog
$OpenFileDialog.initialDirectory = $initialDirectory
$OpenFileDialog.filter = "csv (*.csv)| *.csv"
$OpenFileDialog.ShowDialog() | Out-Null
$OpenFileDialog.FileName
}
Clear-Host
# Get the scan CSV
$inputData = Get-FileName "C:\users\$env.username\Downloads"
$data = Import-Csv $inputData
从这里我在单个脚本中做任何必要的工作。我想将其设置为我一次抓取文件并在脚本之间传递 CSV 的位置:
$data = Import-Csv $inputData
#Call Installed Software script
". .\Build Software List (Test).ps1 $data"
#Call Most Prolific Vulnerabilities
#This continues until I've called all scripts
我已经尝试了几种不同的方法来传递 CSV,但还没有奏效。有人可以告诉我我错过了什么吗?
谢谢!