1

我有以下脚本。

$script:WMIClassNames = `
"CIM_Processor",`
"CIM_PhysicalMemory",`
"Win32_ComputerSystem",`
"CIM_BIOSElement",`
"Win32_OperatingSystem",`
"Win32_NetworkAdapterConfiguration",`
"Win32_Volume",`
"Win32_QuickFixEngineering",`
"CIM_Process",`
"WIN32_Service",`
"WIN32_NTLogEvent"

$script:WMIClassInfo = Get-WmiObject -ComputerName $script:strSysName -Namespace "Root/CIMV2" -List | Select Name | Where-Object {$script:WMIClassNames -contains $_.Name}

当我测量脚本的时间时,在远程机器上执行这个脚本需要将近 4 到 10 分钟。是否可以优化此脚本以减少执行时间?

谢谢您的帮助。

4

0 回答 0