Verifies the digital signature encapsulated in a script.
Object.VerifyFile (FileName, ShowUI) |
Arguments
- object
-
Scripting.Signer
- FileName
-
A string containing the name of the script file.
- ShowUI
-
A Boolean value. If the ShowUI argument is false, then the Scripting.Signer object determines whether a trusted source provided the signature without prompting the user. If it is true then the Scripting.Signer object may create dialog boxes to prompt the user if there is not sufficient information to determine trust.
Note On some operating systems, the operating system also creates a dialog box if the flag is on, the file is trusted, and you have not already checked the "Always trust " option.
Example
Description
The following example demonstrates signature checking using the command-line argument processing features.
Copy Code | |
---|---|
<job> <runtime> <named name="file" helpstring="the file to sign" required="true" type="string"/> <named name="UI" helpstring="produce user interface for untrusted scripts" required="false"/> </runtime> <script language="vbscript"> Dim Signer, File, UI, OK If Not WScript.Arguments.Named.Exists("file") Then WScript.Arguments.ShowUsage WScript.Quit End If Set Signer = CreateObject("Scripting.Signer") File = WScript.Arguments.Named("file") UI = WScript.Arguments.Named.Exists("ui") OK = Signer.VerifyFile(File, UI) If OK Then WScript.Echo File & " is trusted." Else WScript.Echo File & " is NOT trusted." End If </script> </job> |