Remote Shell Infrastructure Improvements
Windows Remote Management version 2.0 (WinRM 2.0) offers many remote shell infrastructure improvements. The following topics describe these improvements in detail:
One of the improvements to the WinRM remote shell infrastructure is the addition of a more robust shell manager that maintains user-specific shell information. WinRM users can create shells on remote computers to run commands or scripts. In addition, users can create multiple shells on a computer. Users and administrators both need the ability to manage shells. Users can enumerate, get, and delete the shells that they have created. Administrators can enumerate over all active shells and retrieve details about specific shells on a local or remote host. Administrators can also delete any active shells on a local or remote host.
When a user or administrator enumerates the active shells, the following information can be returned by the WinRM service.
-
ShellId
-
Specifies the unique identifier for the shell.
-
Environment variables
-
Specifies any environment variables set by the user.
-
WorkingDirectory
-
Specifies the starting directory for the shell.
-
ResourceURI
-
Specifies the resource URI for the shell operation. The resource URI can be used to retrieve plug-in configuration that is specific to the shell instance.
-
IdleTimeout
-
Specifies the maximum duration, in milliseconds, that the shell will stay open without any request.
-
InputStreams
-
Specifies the input streams for the shell.
-
OutputStreams
-
Specifies the output streams for the shell.
-
Shell creation time
-
Specifies the creation timestamp for the shell.
-
IdleTime
-
Specifies the duration, in milliseconds, that the shell has been idle.
-
UserId
-
Specifies the user ID.
-
Hostname or IP address
-
Specifies either the host name or IP address of the computer that created the shell.
-
Shell memory usage
-
Specifies the amount of memory that has been used by the shell.
-
Number of processes
-
Specifies the number of processes that have been created by the shell.
Enumerating a Shell on a Local Host
The following command demonstrates how to use the winrm utility to enumerate shells on a WinRM client: winrm enumerate shell.
The following text-based example displays the output for shell enumeration:
Shell
ShellId = 0A6E6A01-8AB2-4037-86CC-BFC826A1244E
ResourceUri = http://schemas.microsoft.com/wbem/wsman/1/windows/shell/cmd
Owner = FABRIKAM\myAccount
ClientIP = ::1
IdleTimeOut = PT180.000S
InputStreams = stdin
OutputStreams = stdout stderr
ShellRunTime = P0DT0H0M36S
ShellInactivity = P0DT0H0M35S
Shell
ShellId = EE3F11CE-FB3C-4C4E-B113-6F4D643C97D8
ResourceUri = http://schemas.microsoft.com/powershell/Microsoft.PowerShell
Owner = FABRIKAM\myAccount
ClientIP = ::1
IdleTimeOut = PT180.000S
InputStreams = stdin pr
OutputStreams = stdout
ShellRunTime = P0DT0H1M46S
ShellInactivity = P0DT0H0M45S
MemoryUsed = 48MB
ChildProcesses = 0
Shell
ShellId = 8FD7F2C4-A434-4D58-A7E8-46F8BF202D0B
ResourceUri = http://schemas.microsoft.com/powershell/Microsoft.PowerShell
Owner = FABRIKAM\myAccount
ClientIP = ::1
IdleTimeOut = PT180.000S
InputStreams = stdin pr
OutputStreams = stdout
ShellRunTime = P0DT0H1M47S
ShellInactivity = P0DT0H0M47S
MemoryUsed = 48MB
ChildProcesses = 0
For more information, see the online help provided by running the following command: winrm enumerate -?.
Retrieving Information About a Specific Shell
An administrator or user can also use the ShellId identifier to retrieve information about the shell. The following command demonstrates how to use the winrm utility to get information about a specific shell: winrm get shell?ShellId=0A6E6A01-8AB2-4037-86CC-BFC826A1244E.
The following text-based example displays the output for shell information:
Shell
ShellId = 0A6E6A01-8AB2-4037-86CC-BFC826A1244E
ResourceUri = http://schemas.microsoft.com/wbem/wsman/1/windows/shell/cmd
Owner = FABRIKAM\myAccount
ClientIP = ::1
IdleTimeOut = PT180.000S
InputStreams = stdin
OutputStreams = stdout stderr
ShellRunTime = P0DT0H0M36S
ShellInactivity = P0DT0H0M35S
For more information, see the online help provided by the following command: winrm get -?.
Related topics