Export (0) Print
Expand All

Sign Method

Signs a script stored in a string.


                      Object.
                      Sign (FileExtension, Text, Certificate, Store)
                    

object

Scripting.Signer

FileExtension

A string designating the script extension type (.vbs, .js, or .wsf). This provides a mechanism by which the operating system can determine the type of script file being verified.

Text

A string containing the script to be signed.

Certificate

A string designating the author's certificate name.

Store

Optional. A string designating the name of the certificate store. Typically certificates that contain private keys — i.e., certificates you can use for code signing — are in a certificate store called "my". The default value is "my".

The Sign method is used to digitally sign a script stored in a string. In order to create a digital signature, the caller must have a valid certificate.

Dim Signer, UnsignedText, SignedText
Set Signer = CreateObject("Scripting.Signer")
UnsignedText = _
     "Dim X " & vbCrLf & _
     "X = 123" & vbCrLf & _
     "WScript.Echo X" & vbCrLf
SignedText = Signer.Sign(".VBS", UnsignedText, "Your Certificate Name Here")

Community Additions

Show:
© 2015 Microsoft