我已经在Windows 10,但不是在Windows Embdedded标准以下脚本工作:PowerShell脚本工作在Windows 10,但不是在Windows嵌入式标准
$LogTime = Get-Date -Format "MM-dd-yyyy_hh-mm-ss"
$Path1= "TEST\TESTLog_$(get-date -f yyyy-MM-dd).txt"
$AffPBS= Get-Process "LLCService.exe" | Select-Object ProcessorAffinity
$AffLC= Get-Process "LCService.exe" | Select-Object ProcessorAffinity
$AffinityLLCFinal = "LLC " + $AffPBS
$AffinityLCFinal = "LC " + $AffLC
$FinalOutput = $LogTime+" " +$AffinityLLCFinal +" " + $AffinityLCFinal
$FinalOutput | Out-File -Append $Path1
我已运行Powershell_ISE作为管理员,还可以设置Set-ExecutionPolicy RemoteSigned
。
我得到在Windows 10中的结果:
10-09-2017_03-31-10 LLC @{ProcessorAffinity=63} LC @{ProcessorAffinity=63}
结果我得到的Windows 7:
10-09-2017_11-23-26 LLC LC
这似乎是Get-Process
没有工作的Windows Embedded标准。有没有其他的方式来做到这一点。
你为什么认定它不工作?这给了什么:'Get-Process“LLCService.exe”|选择对象ProcessorAffinity?如果这是空的,这会给出什么:'Get-Process explorer |选择processorAffinity'? –