Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Issue calling vbs script in powershell script

$
0
0

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 : NativeCommandError
Here 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


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>