我想将目录添加到我的UWF。 如何通过vb.net或C#做到这一点?
我在Mircrosoft上找到了这些链接。 https://docs.microsoft.com/en-us/windows-hardware/customize/enterprise/uwf-volumeaddexclusion
我已经通过WMICodeCreator在下面尝试了此代码,但例如sInput="c:\Test"
我收到异常错误消息Invalid ObjectPath。
Private Function UwfAddExclusion(sInput As String) As Boolean
Try
Dim classInstance As New ManagementObject("root\StandardCimv2\embedded", "UWF_Volume.ReplaceKeyPropery='ReplaceKeyPropertyValue'", Nothing)
Dim inParams As ManagementBaseObject = classInstance.GetMethodParameters("AddExclusion")
inParams("FileName") = sInput
Dim outParams As ManagementBaseObject = classInstance.InvokeMethod("AddExclusion", inParams, Nothing)
Console.WriteLine("Out parameters:")
Console.WriteLine("ReturnValue: {0}", outParams("ReturnValue"))
Return True
Catch ex As Exception
MsgBox("IsUwfAddExclusion: " + ex.Message)
Return False
End Try
Return False
End Function
谢谢!