Windows command winrs command

Share on facebook
Share on google
Share on twitter
Share on linkedin

winrs

Learn about WinRM & WinRS

 

Windows remote Management allows you to manage and execute programs remotely.

Syntax

winrs [/<parameter>[:<value>]] <command>

Parameters

PARAMETERS
Parameter Description
/remote:<endpoint> Specifies the target endpoint using a NetBIOS name or the standard connection:- : [<transport>://]<target>[:<port>]

if unspecified, app uses  /r:localhost

/unencrypted Specifies that the app will not be encrypt messages to the remote shell . Useful for troubleshooting or when the ipsec encrypts the network traffic, or when you enforce physical security. The app encrupts the messages by default,  using Kerberos or NTLM keys.

The app ignores this command when you select HTTPS transport .

/username:<username> Specifies username on the command line. If not specified, the tool will use Negotiate authentication or prompt for the name.

if you specify /username , you must also specify /password

/password:<password> This command specifies password on command line. If you do not specify /password but specify /username, the tool will prompt for the password.

If you specify/password, You must also specify /username must also be specified.

/timeout:<seconds> This option is deprecated.
/directory:<path> Specifies starting directory for remote shell. If not specified, the remote shell will start in the user’s home directory defined by the environment variable %USERPROFILE%.
/environment:<string>= Specifies a single environment variable to be set when shell starts, which allows changing default environment for shell. You must use multiple occurrences of this switch must to specify multiple environment variables.
/noecho Specifies that echo should be disabled. This may be necessary to ensure that user’s answers to remote prompts are not displayed locally.By default echo equals on.
/noprofile Specifies that the user’s profile should not be loaded. By default, the server will attempt to load the user profile.

if the remote user does not have local administrator privelege on the target system, then the app requires this option  (the default will result in error).

/allowdelegate Specifies that the user’s credentials can be used to access a remote share, for example, found on a different machine than the target endpoint.
/compression Turn on compression. Older installations on remote machines may not support compression so it is off by default.The setting defaultsis off, since older installations on remote machines may not support compression.
/usessl Use an SSL connection when using a remote endpoint. Specifying this instead of the transport https: will use the default WinRM default port.
/? Displays help at the command prompt.

 

 

Remarks

  • All command-line options accept either short form or long form. For example both /r and /remote are valid.
  • To terminate the /remote command, the user can type Ctrl-C or Ctrl-break, which will be sent to the remote shell. The second Ctrl-C will force termination of winrs.exe.
  • To manage active remote shells or winrs configuration, use the WinRM tool. The URI alias to manage active shells is shell/cmd. The app uses  winrm/config/winrs for URI alias for winrs configuration .

Examples

winrs /r:https://contoso.com command
winrs /r:contoso.com /usessl command
winrs /r:myserver command
winrs /r:http://127.0.0.1 command
winrs /r:http://169.51.2.101:80 /unencrypted command
winrs /r:https://[::FFFF:129.144.52.38] command
winrs /r:http://[1080:0:0:0:8:800:200C:417A]:80 command
winrs /r:https://contoso.com /t:600 /u:administrator /p:$%fgh7 ipconfig
winrs /r:myserver /env:path=^%path^%;c:\tools /env:TEMP=d:\temp config.cmd
winrs /r:myserver netdom join myserver /domain:testdomain /userd:johns /passwordd:$%fgh789
winrs /r:myserver /ad /u:administrator /p:$%fgh7 dir \\anotherserver\share