Reputation: 5
Is it possible to convert the following code from Powershell to vbscript?
ListCPUForCitrixFarm.Ps1:<br>
OutFile = "C:\citrix_cpu.txt"<br>
ListCPUForCitrixFarm.Ps1:
OutFile = "C:\citrix_cpu.txt"
Add-PSSnapin Citrix.XenApp.Commands -ErrorAction SilentlyContinue
Get-Date | out-file OutFile
Get-XAFARM | out-file OutFile -Append
Get-XAAdministrator -Current | FT | out-file OutFile -Append
$computers = (get-xaserver | Select Servername)
$CPUs = @()
foreach ($computer in $computers)
{
$ComputerCpu = $ProcessorStats.LoadPercentage
$objCPU = New-Object System.Object
$objCPU | Add-Member -MemberType NoteProperty -Name CPULoadPercent -Value $ComputerCpu
$CPUs += $objCPU
}
$CPUs | FT -Wrap | out-file OutFile -Append
Exit 0
I could not find any vbscript references related to Citrix Farm information (Get-XAAdministrator
, Get-XAServerHotfix
, Get-XAFARM
, Citrix.XenApp.Commands
, etc.).
It looks like Powershell is the only way to deal with Citrix.
Upvotes: 0
Views: 370
Reputation: 202102
No. You're not going to be able use a PowerShell snapin from VBScript without doing something hacky like shelling out to PowerShell from VBScript. FWIW PowerShell has been shipping since 2006. It is the automation platform for Windows superseding Windows Script Host & VBScript.
Upvotes: 3