我不知道为什么这个命令输出错误。启用的属性应该可以工作。
Set-WmiInstance -Class win32_OfflineFilesCache -Property Enabled = "False"
如果我将 -Property 更改为 -Arguments,我无法更改“Enabled”的值。所以在上面的命令中我仍然无法更改值。
有什么想法或提示吗?
谢谢大家,我是这样解决的:
Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Services\CscService" -Name "Start" -Value 1
这对我有用:
Invoke-WmiMethod -Class win32_OfflineFilesCache -Name Enable False
这应该可行,因为它是静态方法:
([WmiClass]'Win32_OfflineFilesCache').enable($true)