IT tutorials
 
Windows
 

Windows Server 2008 : Remote Administration (part 1) - Configuring, Verifying, and Removing winrm, Using winrs to Issue Commands

- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Malwarebytes Premium 3.7.1 Serial Keys (LifeTime) 2019
2/16/2013 5:05:00 PM

1. Configuring, Verifying, and Removing winrm

When using Windows Remote Management (winrm) and Windows Remote Shell (winrs), both computers must be configured with winrm. The basic command to configure the computers is

winrm quickconfig

You’re prompted to confirm the changes and after you do, winrm creates a winrm listener and a firewall exception.

You can view the details on the listener with the winrm enumerate command, and you can shorten enumerate to just e. The following listing shows the command and the output:

C:\>winrm e winrm/config/listener
Listener
    Address = *
    Transport = HTTP
    Port = 80
    Hostname
    Enabled = true
    URLPrefix = wsman
    CertificateThumbprint
    ListeningOn = 127.0.0.1, 192.168.1.5, ::1,
fe80::5efe:192.168.1.5%12, fe80::c065:e623:4104:1469%10

Tip

If the winrm e winrm/config/listener command doesn’t give any output, it means that the winrm listener is not installed. Execute the winrm quickconfig command to install it.


The winrm HTTP listener on port 80 listens for and acts on winrs commands that send their commands through HTTP on port 80.

If you want to delete the winrm listener, you can use the following command:

winrm invoke restore winrm/config @{}

Note

There are no spaces before or after the slash (/) in the winrm/config clause, but there is a space after config.

2. Using winrs to Issue Commands

After winrm has configured both computers, you can then use winrs to issue commands against either computer. The basic syntax is

winrs -r:server-name command

For example, if you want to enable a remote Server Core computer named SC1 to respond to pings, use this command locally on the Server Core computer:

netsh firewall set icmpsetting 8

However, you can also use this command from a remote computer:

winrs -r:sc1 netsh firewall set icmpsetting 8

The following table shows some commands you can use. Each of these examples is run against a remote Windows Server 2008 Server Core computer named sc1 (identified in the command as -r:sc1).



Example winrs CommandsComments
Retrieve version of remote computer.
C:\>winrs -r:sc1 ver

Shows the version of the computer. Windows Server 2008 is Microsoft Windows [Version 6.0.6001]. Windows Server 2008 R2 is Microsoft Windows [Version 6.1.7600].
View TCP/IP configuration.
C:\>winrs -r:sc1 ipconfig/all

Views the TCP/IP configuration of the remote system.


Set address of alternate DNS server.
C:\>winrs -r:sc1 netsh
interface ipv4 add dnsserver
name="local area connection"
192.168.1.7 index=2

You can use the netsh command to set the address of the DNS server. The alternate DNS server is configured with the add command and using an index of 2.


View file listing.
C:\>winrs -r:sc1 dir c:\

Shows the file listing of all the files in the root of C on the remote system.
Install an application.
C:\>winrs -r:sc1 msiecec.exe
/i c:\apps\app.msi /quiet

You can use the msiexec command with the /i switch to install a file from the command prompt. The example installs an application named app.msi in the c:\apps folder and the /quiet switch suppresses confirmation.
Restart the netlogon service.
C:\>winrs -r:sc1 net stop
netlogon
C:\>winrs -r:sc1 net start
netlogon

These commands stop and restart the netlogon service, which forces the registration of SRV records.


List services and their state.
C:\>winrs -r:sc1 wmic service
list brief

Lists the services on the remote computer.

Tip

You can issue any wmic commands against the remote computer.



Access the command prompt on a remote system.
C:\>winrs -r:sc1 cmd.exe

After executing this command, the command prompt directly interacts with the remote system. You don’t need to add winrs prefixes but instead just type the commands (such as ipconfig or ping).

Note

The prompt changes but it’s not apparent that you are on the remote system. To double-check whether you enter commands against the local system or the remote system, use hostname.

Tip

To exit the remote command prompt, type exit.
 
Others
 
- Windows 8 : The Classic Interface - The Taskbar
- Windows 8 : The Classic Interface - Start Me Up, Desktop Elements
- Windows Home Server 2011 : Understanding Windows Home Server’s Backup Technology
- Windows Home Server 2011 : Making Connections to Network Computers - Customizing the Remote Web Access Pages
- Windows 8 : Managing the BCD Store
- Windows 8 : Managing Startup and Boot Configuration
- Managing Windows Small Business Server 2011 : Accessing Remote Computers (part 2) - Using Microsoft Management Console
- Managing Windows Small Business Server 2011 : Accessing Remote Computers (part 1) - Using Remote Desktop
- Windows 8 : Diagnosing and Resolving Startup Problems
- Windows 8 : Navigating Startup and Power States
 
 
Top 10
 
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
Technology FAQ
- Is possible to just to use a wireless router to extend wireless access to wireless access points?
- Ruby - Insert Struct to MySql
- how to find my Symantec pcAnywhere serial number
- About direct X / Open GL issue
- How to determine eclipse version?
- What SAN cert Exchange 2010 for UM, OA?
- How do I populate a SQL Express table from Excel file?
- code for express check out with Paypal.
- Problem with Templated User Control
- ShellExecute SW_HIDE
programming4us programming4us