Reputation: 456
I'm trying to create a simple vbs script to get UWF status:
Set objWMIService = GetObject("winmgmts:\\.\root\StandardCimv2\embedded:UWF_Filter")
WScript.Echo objWMIService.CurrentEnabled
The output is null
even if I run it as administrator.
Upvotes: 1
Views: 179
Reputation: 456
I found the solution: I've to look for the instances of UWF_Filter. This is the working code for UWF_filter
Set uwfFilters = GetObject("winmgmts:\\.\root\StandardCimv2\embedded:UWF_Filter")
Set oInstances = uwfFilters.instances_()
For Each oInstance In oInstances
if oInstance.CurrentEnabled and oInstance.NextEnabled then
Wscript.Echo "Enabled"
elseif oInstance.CurrentEnabled and not oInstance.NextEnabled then
Wscript.Echo "Enabled (will be disabled)"
elseif not oInstance.CurrentEnabled and oInstance.NextEnabled then
Wscript.Echo "Disabled (will be enabled)"
else
Wscript.Echo "Disabled"
end if
Next
Bonus point: this script is intended for BGInfo, so you need to replace Wscript.Echo
with Echo
.
Upvotes: 2