Newbie here - Trying to call a vbs script in a powershell script and pass it some parameters but I keep getting an error and can't figure out what is wrong. Any help is greatly appreciated!
Here is the error:
cscript.exe : C:\Users\xxx\AppData\Local\Temp\ConvertXML.vbs(5, 1) Microsoft VBScript runtime error: Object required: 'WshShell' At C:\Users\xxx\Desktop\GPO XML Report\GPOReport.ps1:20 char:12+ cscript.exe <<<< ConvertXML.vbs $XMLReport $GPName+ CategoryInfo : NotSpecified: (C:\Users\xxx...red: 'WshShell':String) [], RemoteException+ FullyQualifiedErrorId : NativeCommandErrorHere is the script:
#Import Modules Import-Module GroupPolicy $GPName = "Citrix-Production" $TempDir = [System.IO.Path]::GetTempPath() $XMLDir = $TempDir+"\"+"GPName"+"."+"xml" $XMLReport = "GPName"+"."+"xml" $SciptPath = "$TempDir"+"\"+"ConvertXML.vbs" $VBScript = "ConvertXML.vbs" $FileExists = Test-Path $SciptPath Get-GPO -name "$GPName" Get-GPOReport -name "$GPName" -ReportType XML -Path $XMLDir IF ($FileExists -eq $False) {Copy-Item "$VBScript" -destination $TempDir -recurse} cd $TempDir cscript.exe ConvertXML.vbs $XMLReport $GPName