我正在尝试在下面工作set-strictmode -version latest,它在没有严格模式的情况下完全可以正常工作,不幸的是,在我的环境中需要有最新的严格模式。
它的作用:通过注册表查找带有 EEELinkAdvertisement 的条目并将其分配给 $findEeeLinkAd
$findEeeLinkAd = Get-ChildItem -LiteralPath 'hklm:\SYSTEM\ControlSet001\Control\Class' -Recurse -ErrorAction SilentlyContinue | `
% {Get-ItemProperty -Path $_.pspath -ErrorAction SilentlyContinue | `
? {$_.EeeLinkAdvertisement} -ErrorAction SilentlyContinue }
Run Code Online (Sandbox Code Playgroud)
尽管在管理员中运行,我还是收到了一堆以下错误:
The property 'EEELinkAdvertisement' cannot be found on this object. Verify that the property exists.
At line:3 char:12
+ ? {$_.EEELinkAdvertisement} }
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], PropertyNotFoundException
+ FullyQualifiedErrorId : PropertyNotFoundStrict
Run Code Online (Sandbox Code Playgroud)
任何帮助,将不胜感激!