是否可以将以下代码从Powershell转换为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
我找不到与Citrix Farm信息相关的任何vbscript引用(Get-XAAdministrator
,Get-XAServerHotfix
,Get-XAFARM
,Citrix.XenApp.Commands
等。)
看起来Powershell是处理Citrix的唯一方式。
答案 0 :(得分:3)
没有。您无法使用VBScript中的PowerShell管理单元而不会像从VBScript中弹出PowerShell那样做一些hacky。 FWIW PowerShell自2006年开始发售。它是Windows自动化平台取代Windows Script Host&amp;的VBScript。