Partager via


Using Windows PowerShell

You can use Windows PowerShell to administer Server Core remotely, but only if you use WMI in your PowerShell commands. PowerShell WMI commands typically take the following form:

Get-WMIObject WMIclass -computername servername

where WMIclass is the WMI class you want to access and servername is the name of the remote Server Core installation.

Tip To display a list of all WMI classes supported on a remote Server Core installation, type Get-WMIObject-list-computername servername at the PowerShell command prompt.

Here is an example of using PowerShell (running on a computer running Windows Vista on which PowerShell 1.0 has been installed) to display a list of services installed on a Server Core installation named SEA-SC2 that belongs to the same domain. Perform the following steps:

  1. On the Server Core installation, enable the Windows Management Instrumentation (WMI) rule group in Windows Firewall by typing the following command:

    netsh advfirewall firewall set rule group="Windows Management -Instrumentation (WMI)" new enable=yes

  2. On the computer running Windows Vista, open the PowerShell command prompt by clicking Start, All Programs, Windows PowerShell 1.0, and finally Windows PowerShell.

  3. Use the command shown here to display a list of services installed on SEA-SC2:

    PS C:\Users\tallen> Get-WMIObject Win32_Service -computername SEA-SC2 
    
    
    ExitCode  : 0 
    Name      : AeLookupSvc 
    ProcessId : 964 
    StartMode : Auto 
    State     : Running 
    Status    : OK 
    
    ExitCode  : 1077 
    Name      : AppMgmt 
    ProcessId : 0 
    StartMode : Manual 
    State     : Stopped 
    Status    : OK 
    . . .
    

Note You cannot install Windows PowerShell 1.0 locally on Server Core.

For a quick introduction to using Windows PowerShell, see the Windows PowerShell Getting Started Guide on MSDN at https://msdn.microsoft.com/en-us/library/aa973757(VS.85).aspx.

< Back     

 

 

© Microsoft. All Rights Reserved.