ConnectionOptions.Password property

Sets the password of a local or a domain account on the remote computer. This property determines the password for authentication. For more information, see Authentication for Remote Connections.

This property is read/write.

Syntax

ConnectionOptions.Password As String

Property value

String that contains the password of a local or a domain account on the remote computer.

If no value is supplied and the WSManFlagCredUsernamePassword flag is not set, the password of the account that is running the script is used.

If no value is supplied and the WSManFlagCredUsernamePassword flag is set, the script prompts the user to enter the password (and the user name, if this is not supplied). If a valid user name and password are not entered, then an access denied error is returned.

Remarks

Be aware that you cannot retrieve the password. The password can only be set with this property.

If you create a ConnectionOptions object and use a user name and password to connect to Windows Remote Management, then the WSManFlagCredUserNamePassword flag should be set on the call to WSMan.CreateSession.

For more information about setting passwords, see the Remarks section in ConnectionOptions.

Examples

The following code example creates a ConnectionOptions object and sets the Password.

' Create a WSMan object. 
Set objWsman = CreateObject( "WSMAN.Automation" )
' Create a ConnectionOptions object
Set objOptions = objWSMan.CreateConnectionOptions
objOptions.Password = "<password>"

Requirements

Requirement Value
Minimum supported client
Windows Vista
Minimum supported server
Windows Server 2008
Header
WSManDisp.h
IDL
WSManDisp.idl
Library
WSManDisp.tlb
DLL
WSMAuto.dll

See also

ConnectionOptions