Server Manager z linii poleceń (servermanagercmd.exe)
Wstęp
Zarządzanie Windows Server 2008 zostało znacznie uproszczone poprzez dodanie zupełnie nowej przystawki MMC. Server Manager, bo tak nazywa się to narzędzie przejmuje zadania wielu samodzielnych konsol znanych z Windows Server 2003, np. Manage Your Server, Configure Your Server, and Add or Remove Windows Components. Jej głównym zadaniem jest dodawanie, usuwanie oraz konfiguracja usług, ról i funkcji dodatkowych serwera. Za jej pomocą możliwa jest także diagnostyka serwera, zarządzanie lokalnymi użytkownikami oraz grupami, wykonywanie backupów.
Server Manager command-line tool
W Windows Server 2008 beta 3 zostało dodane narzędzie Server Manager command-line. Jest to tekstowy odpowiednik graficznego Server Managera. Pozwala na wykonanie części zadań bez konieczności korzystania z Windows GUI. Za jego pomocą można instalować i usuwać role serwera oraz wykonywać zapytania do systemu. Bardzo ważną cechą jest to, że plik używany w poleceniu, jako parametr, jest zgodny ze standardem XML.
Opcje
Lista opcji, jakie można użyć z poleceniem ServerManagerCMD.exe to:
|
-query [<query.xml>] [-logPath <log.txt>]
-install <name> [-setting <setting name>=<setting value>]* [-allSubFeatures] [-resultPath <result.xml> [-restart] | -whatIf] [-logPath <log.txt>]
-remove <name> [-resultPath <result.xml> [-restart] | -whatIf] [-logPath <log.txt>]
-inputPath <answer.xml> [-resultPath <result.xml> [-restart] | -whatIf] [-logPath <log.txt>]
-help | -?
-version |
Poniżej został umieszczony opis przełączników:
-query [<query.xml>]
Wyświetla listę dostępnych w systemie ról oraz funkcji. Role zainstalowane na serwerze zostaną dodatkowo wyróżnione. Jeśli został dodany przełącznik <query.xml> to wynik zapytania zostanie zapisany także do pliku w formacie XML. Posiadając taki plik mamy informacje o wszystkich rolach i funkcjach serwera. Skrócona forma przełącznika to -q.
-inputpath <answer.xml>
Pozwala instalować lub usuwać role i funkcje wymienione w pliku odpowiedzi podanym jako parametr <answer.xml>. Forma skrócona: -ip.
UWAGA: Pliku wygenerowanego za pomocą przełącznika -query nie można bezpośrednio użyć, jako parametr w -inputpath oraz -install. Potrzebne są pewne modyfikacje pliku XML. Przykładowe użycie zostanie przedstawione w dalszej części artykułu.
-install <name> [-setting <setting name>=<setting value>]* [-allSubFeatures]
Instaluje rolę lub funkcję podaną jako parametr <name>. Lista nazw ról oraz funkcji została podana na w dodatku do tego artykułu. Forma skrócona -i.
Parametr Install posiada dodatkowe opcje:
-setting <setting name>=<setting value>
Pozwala na dodanie dodatkowych parametrów instalacji. Lista dodatkowych ustawień znajduje się w dodatku. Skrócona forma: -s.
-allSubFeatures
Pozwala zainstalować wszystkie role i funkcje podrzędne wraz z rolą lub funkcja nadrzędną wyspecyfikowaną w parametrze -install <name>.
-remove <name>
Usuwa rolę lub funkcję podaną jako parametr <name>. Lista nazw ról oraz funkcji została podana na w dodatku. Forma skrócona -r.
Parametry install oraz remove posiadają także parametry resultPath, restart oraz whatif, które zostały omówione poniżej:
-resultPath <result.xml>
Zapisuje rezultat działania do pliku wskazanego, jako parametr <result.xml>. Skrócona forma: -rp.
-restart
Jeśli po instalacji/usunięciu roli lub funkcji konieczny jest restart to zostanie on automatyczny wykonany.
-whatIf
Zastosowanie przełącznika spowoduje tylko wyświetlenie rezultatu polecenia, które chcemy wykonać. Samo polecenie nie zostanie wykonane. Skrócona wersja: -w.
UWAGA: Nie można użyć -resultPath wraz z parametrem –whatif
-logPath <log.txt>
Parametr pozwala na określenie innej niż domyślna ścieżki oraz nazwy pliku logu. Domyślnie plik zostaje zapisany w: %windir%\temp\servermanager.log. Skrócona forma -l.
-help
Wyświetla pomoc dotyczącą polecenia ServerManagerCMD.exe. Skrócona forma: -?
-version
Jak wynik podaje wersje Server Managera. Skrócona forma –v.
Przykłady użycia
Wyświetlenie zainstalowanych ról i funkcji serwera
Wszystkie role i funkcje serwera wyświetlimy wywołując polecenie:
servermanagercmd.exe –query lista.xml
Zainstalowane funkcje i role zostaną wyróżnione w spisie kolorem zielonym. Opcjonalny parametr lista.xml dodatkowo spowoduje zapisanie listy do pliku w formacie XML. Fragment listy przedstawiono poniżej:
|
- <ServerManagerConfigurationQuery Time="2007-05-06T18:49:29" Language="en-US" xmlns="http://schemas.microsoft.com/sdm/Windows/ServerManager/Configuration/2007/1">
- <Role DisplayName="Active Directory Certificate Services" Installed="false" Id="AD-Certificate">
<RoleService DisplayName="Certification Authority" Installed="false" Id="ADCS-Cert-Authority" Default="true" />
<RoleService DisplayName="Certification Authority Web Enrollment" Installed="false" />
<RoleService DisplayName="Online Certificate Status Protocol" Installed="false" Id="ADCS-Online-Cert" />
<RoleService DisplayName="Microsoft Simple Certificate Enrollment Protocol" Installed="false" />
</Role>
- <Role DisplayName="Active Directory Domain Services" Installed="false">
<RoleService DisplayName="Active Directory Domain Controller" Installed="false" Id="ADDS-Domain-Controller" Default="true" />
- <RoleService DisplayName="Identity Management for UNIX" Installed="false" Id="ADDS-Identity-Mgmt">
<RoleService DisplayName="Server for Network Information Services" Installed="false" Id="ADDS-NIS" Default="true" />
<RoleService DisplayName="Password Synchronization" Installed="false" Id="ADDS-Password-Sync" Default="true" />
</RoleService>
</Role> |
Aby sprawdzić czy w systemie jest zainstalowany klient lub serwer Telnet możemy posłużyć się poleceniem:
servermanagercmd.exe -query | find "telnet"
Z rysunku powyżej wynika, że w systemie została zainstalowana tylko funkcja klienta Telnet.
Instalacja ról i funkcji serwera
W poniższym przykładzie pokazano jak za pomocą przełącznika -install (-i) dodać funkcje serwera jaką jest Telnet Client.
servermanagercmd.exe -i telnet-client
Poniżej przedstawiono zastosowanie przełącznika whatif, który wyświetla tylko i wyłącznie wynik wykonania operacji bez wykonania polecenia. W poniższym przykładzie przełącznik whatif poinformuje, że instalacja nie powiedzie się, ponieważ funkcja telnet-client jest już zainstalowana.
servermanagercmd.exe -i telnet-client -whatif
Instalacja ról servera jest równie prosta. Oczywiście należy pamiętać o tym, że rolę należy później poprawnie skonfigurować.
Poniżej przykład usunięcia roli Active Directory Lightweight Directory Services.
servermanagercmd.exe -remove ADLDS
Instalacja z pliku XML
Role i funkcje można instalować na podstawie pliku odpowiedzi. Poniższy plik XML został przygotowany w celu instalacji klienta telnet oraz serwera DHCP.
|
<ServerManagerConfiguration Action="Install" xmlns="http://schemas.microsoft.com/sdm/Windows/ServerManager/Configuration/2007/1">
<Feature Id="Telnet-Client" />
<Role Id="DHCP" />
</ServerManagerConfiguration> |
Powyższy listing pliku XML posłużył do wywołania polecenia:
servermanagercmd -inputpath c:\aktu.xml
Wynik został przedstawiony na rysunku poniżej. Jak widać ServerManagerCMD sprawdza czy role oraz funkcje są zainstalowane. W naszym przykładzie klient telnet był już zainstalowany i dlatego jego instalacja została pominięta. Serwer DHCP został zainstalowany poprawnie.
Dodatek
Usługi w zakresie poszczególnych ról serwera i ich identyfikatory z linii komend (źródło Microsoft.com 2007-05-07)
|
Usługi |
Wartość |
Notatka |
|
DHCP Server |
DHCP |
Rola DHCP Server powinna być instalowana z ustawieniami domyślnymi. |
|
Print Services |
|
Print Server |
|
Internet Printing |
|
LPD Service | |
|
Print-Server |
|
Print-Services |
|
Print-Internet |
|
Print-LPD-Service |
|
Podczas usuwania tej roli z Server Manager UI, użytkownik jest pytany o to czy mają zostać usunięte instancje drukarek skonfigurowanych na serwerze. Domyślnie instancje są zachowywane. Jest to także domyślne zachowanie przy usuwaniu roli z linii komend. |
|
Terminal Services |
|
Terminal Server |
|
TS Licensing |
|
TS Gateway |
|
TS Web Access |
|
TS Session Broker | |
|
Terminal-Services |
|
TS-Terminal-Server |
|
TS-Licensing |
|
TS-Gateway |
|
TS-Web-Access |
|
TS-Session-Broker | |
Ponieważ ustawiania usług terminalowych mogą być skonfigurowane po zainstalowaniu roli nie jest wymagane wyspecyfikowane ich w pliku odpowiedzi. |
|
Active Directory Domain Services |
|
Active Directory Domain Controller |
|
Identity Management for UNIX |
|
Server for Network Information Service |
|
Password Synchronization | |
|
(brak) |
|
ADDS-Domain-Controller |
|
ADDS-Identity-Management |
|
ADDS-NIS |
|
ADDS-Password-Sync |
|
Po instalacji Active Directory Domain Services konieczne jest uruchomienie polecenia dcpromo, aby wypromować serwer do kontrolera domeny. Nie powiedzie się usunięcie roli Active Directory Domain Services w czasie gdy serwer pełni role kontrolera domeny. Konieczne jest wcześniejsze zdegradowania kontrolera do roli standardowego członka domeny. |
|
DNS Server |
DNS |
Brak |
|
File Services |
|
Distributed File System (DFS) |
|
DFS Namespace |
|
DFS Replication |
|
File Server Resource Manager |
|
Services for Network File System |
|
Windows Search Service |
|
Windows Server 2003 File Services |
|
File Replication Service |
|
Indexing Service |
|
|
(brak) |
|
FS-DFS |
|
FS-DFS-Namespace |
|
FS-DFS-Replication |
|
FS-Resource-Manager |
|
FS-NFS-Services |
|
FS-Search-Service |
|
FS-Win2003-Services |
|
FS-Replication |
|
FS-Indexing-Service |
|
Nie można zainstalować ani usunąć File Services za pomocą polecenia ServerManagerCMD.exe. Aby to zrobić należy użyć graficznego interfejsu Server Manager.
Ponieważ ustawienia File Services mogą być skonfigurowane po zainstalowaniu roli nie jest wymagane wyspecyfikowane ich w pliku odpowiedzi.
Należy zauważyć że Services for Network File nie jest częścią roli File Services na komputerach z Windows Server 2008 IA64. Ta funkcja jest dostępna na 64 bitowej wersji Windows Server 2008. |
|
Web Server (IIS) |
|
Internet Information Services |
|
Common HTTP Features |
|
Static Content |
|
Default Document |
|
Directory Browsing |
|
HTTP Errors |
|
HTTP Redirection |
|
Application Development |
|
ASP.NET |
|
.NET Extensibility |
|
ASP |
|
CGI |
|
ISAPI Extensions |
|
ISAPI Filters |
|
Server Side Includes |
|
Health and Diagnostics |
|
HTTP Logging |
|
Logging Tools |
|
Request Monitor |
|
Tracing |
|
Custom Logging |
|
ODBC Logging |
|
Security |
|
Basic Authentication |
|
Windows Authentication |
|
Digest Authentication |
|
Client Certificate Mapping Authentication |
|
IIS Client Certificate Mapping Authentication |
|
URL Authorization |
|
Request Filtering |
|
IP and Domain Restrictions |
|
Performance |
|
Static Content Compression |
|
Dynamic Content Compression |
|
Management Tools |
|
IIS Management Console |
|
IIS Management Scripts and Tools |
|
Management Service |
|
IIS 6 Management Compatibility |
|
IIS 6 Metabase Compatibility |
|
IIS 6 WMI Compatibility |
|
IIS 6 Scripting Tools |
|
IIS 6 Management Console |
|
FTP Publishing Service |
|
FTP Server |
|
FTP Management Console |
|
|
Web-Server |
|
Web-WebServer |
|
Web-Common-Http |
|
Web-Static-Content |
|
Web-Default-Doc |
|
Web-Dir-Browsing |
|
Web-Http-Errors |
|
Web-Http-Redirect |
|
Web-App-Development |
|
Web-Asp-Net |
|
Web-Net-Ext |
|
Web-ASP |
|
Web-CGI |
|
Web-ISAPI-Ext |
|
Web-ISAPI-Filter |
|
Web-Includes |
|
Web-Health |
|
Web-Http-Logging |
|
Web-Log-Libraries |
|
Web-Request-Monitor |
|
Web-Http-Tracing |
|
Web-Custom-Logging |
|
Web-ODBC-Logging |
|
Web-Security |
|
Web-Basic-Auth |
|
Web-Windows-Auth |
|
Web-Digest-Auth |
|
Web-Client-Auth |
|
Web-Cert-Auth |
|
Web-Url-Auth |
|
Web-Filtering |
|
Web-IP-Security |
|
Web-Performance |
|
Web-Stat-Compression |
|
Web-Dyn-Compression |
|
Web-Mgmt-Tools |
|
Web-Mgmt-Console |
|
Web-Scripting-Tools |
|
Web-Mgmt-Service |
|
Web-Mgmt-Compat |
|
Web-Metabase |
|
Web-WMI |
|
Web-Lgcy-Scripting |
|
Web-Lgcy-Mgmt-Console |
|
Web-Ftp-Publishing |
|
Web-Ftp-Server |
|
Web-Ftp-Mgmt-Console |
|
Brak |
|
Windows SharePoint Services |
Windows-SharePoint |
Aby poprawnie zainstalować Windows SharePoint Services należy poprawnie wyspecyfikować ustawienia konfiguracyjne w pliku odpowiedzi.
Wymagane ustawienia dla tej roli zawierają informacje na temat języka Windows SharePoint Services administrative Web site oraz to czy usługi Windows SharePoint Services są instalowane w trybie Single Server, czy są częścią farmy serwerów.
Atrybut InstallAsPartOfServerFarm wskazuje na tryb w jakim usługi mają zostać zainstalowane. InstallsAsPartOfServerFarm="true" spowoduje zainstalowanie usługi w trybie farmy, natomiast InstallsAsPartOfServerFarm="false" w trybie single server.
Atrybut Language określa w jakim języku ma pracować Windows SharePoint Services administrative Web site.
Poniższa tabela zawiera listę dostępnych języków.
|
Język |
Wartość |
|
Czech |
cs-CZ |
|
Dutch |
nl-nl |
|
English |
en-us |
|
French |
FR-FR |
|
German |
de-de |
|
Hungarian |
hu-HU |
|
Italian |
it-it |
|
Polish |
pl-pl |
|
Portuguese |
pt-PT |
|
Romanian |
ro-RO |
|
Russian |
ru-RU |
|
Spanish |
ES-ES |
|
Swedish |
sv-se |
|
Turkish |
tr-TR |
|
Danish |
da-DK |
|
Finnish |
fi-FI |
|
Norwegian (Bokmål) |
nb-NO |
|
Greek |
el-GR |
|
Japanese |
ja-jp |
|
Korean |
ko-kr |
|
Chinese (Traditional)--Taiwan |
zh-tw |
|
Chinese (China) |
zh-cn |
|
Chinese (Traditional)--Hong Kong SAR |
zh-hk |
|
Arabic |
ar-sa |
|
Hebrew |
he-il |
|
Hindi |
hi-in |
|
Thai |
th-th |
|
Portuguese (Brazil) |
pt-br |
|
|
Active Directory Federation Services |
|
Federation Service |
|
Federation Service Proxy |
|
Web Agents |
|
Claims-aware Agent |
|
Windows Token-based Agent | |
|
(brak) |
|
ADFS-Federation |
|
ADFS-Proxy |
|
ADFS-Web-Agents |
|
ADFS-Claims |
|
ADFS-Windows-Token | |
Rola Active Directory Federation Services powinna być instalowana z ustawieniami domyślnymi. |
|
Active Directory Lightweight Directory Services |
ADLDS |
Brak |
|
Application Server |
|
Application Server Core |
|
Web Server Support |
|
COM+ Network Access |
|
TCP Port Sharing |
|
Windows Process Activation Service Support |
|
HTTP Activation |
|
Message Queuing Activation |
|
TCP Activation |
|
Named Pipes Activation |
|
Distributed Transaction Support |
|
Incoming Remote Transactions |
|
Outgoing Remote Transactions |
|
WS-Atomic Transaction Support | |
|
Application-Server |
|
AS-AppServer-Core |
|
AS-Web-Support |
|
AS-Ent-Services |
|
AS-TCP-Port-Sharing |
|
AS-WAS-Support |
|
AS-HTTP-Activation |
|
AS-MSMQ-Activation |
|
AS-TCP-Activation |
|
AS-Named-Pipes |
|
AS-Dist-Transaction |
|
AS-Incoming-Trans |
|
AS-Outgoing-Trans |
|
AS-WS-Atomic | |
Jeśli instalowana jest rola WS-Atomic Transaction Support to należy skonfigurować ją do użycia self-signed certificate |
|
Active Directory Certificate Services |
|
Certification Authority |
|
Certification Authority Web Enrollment (not installable by using the command line) |
|
Online Certificate Status Protocol |
|
Microsoft Simple Certificate Enrollment Protocol (not installable by using the command line) |
|
|
(brak) |
|
ADCS-Cert-Authority |
|
AD-Certificate |
|
ADCS-Online-Cert | |
Tylko Certification Authority i Online Certificate Status Protocol mogą być instalowane za pomoca ServerManagerCMD.exe |
|
Fax Server |
Fax |
Rola Fax Server powinna być instalowana z ustawieniami domyślnymi. |
|
Network Policy and Access Services |
|
Network Policy Server |
|
NPAS Routing and Remote Access Services |
|
Remote Access Service |
|
Routing |
|
Health Registration Authority | |
|
NPAS |
|
NPAS-Policy-Server |
|
NPAS-RRAS-Services |
|
NPAS-RRAS |
|
NPAS-Routing |
|
NPAS-Health | |
Ponieważ ustawiania Network Policy and Access Services mogą być skonfigurowane po zainstalowaniu roli nie jest wymagane wyspecyfikowane ich w pliku odpowiedzi. |
|
Active Directory Rights Management Services (AD RMS) |
|
Rights Management Server | |
Active Directory Rights Management Services (AD RMS) cannot be installed by using the Server Manager command line. |
Brak |
|
UDDI Services |
|
UDDI Services Web Application |
|
UDDI Services Database | |
UDDI Services is not installable by using the Server Manager command line. |
Nie można instalować UDDI Services za pomocą ServerManagerCMD.exe, ponieważ podczas instalacji wymagane są złożone ustawienia bazy danych |
|
Windows Deployment Services |
WDS |
Brak |
Funkcje i ich identyfikatory (źródło Microsoft.com – 2007-05-07)
Funkcja |
Wartość |
Notatka |
|
Failover Clustering |
Failover-Clustering |
|
|
Network Load Balancing |
NLB |
|
|
Desktop Experience |
Desktop-Experience |
|
|
.NET Framework 3.0 Features |
|
.NET Framework 3.0 |
|
XPS Viewer |
|
Windows Communication Foundation Activation Components |
|
HTTP Activation |
|
Non-HTTP Activation | |
|
NET-Framework |
|
NET-Framework-Core |
|
NET-XPS-Viewer |
|
NET-Win-CFAC |
|
NET-HTTP-Activation |
|
NET-Non-HTTP-Activ | |
Należy zauważyć że skladnia dla .NET Framework 3.0 nie zawiera znaku "." przed wyrazem NET. |
|
Windows System Resource Manager |
WSRM |
|
|
Wireless Networking |
Wireless-Networking |
|
|
Windows Server Backup |
Backup |
|
|
WINS Server |
WINS-Server |
|
|
Remote Assistance |
Remote-Assistance |
|
|
Simple TCP/IP Services |
Simple-TCPIP |
|
|
Telnet Client |
Telnet-Client |
|
|
Telnet Server |
Telnet-Server |
|
|
Subsystem for UNIX-based Applications |
Subsystem-UNIX-Apps |
|
|
RPC over HTTP Proxy |
RPC-over-HTTP-Proxy |
|
|
SMTP Server |
SMTP-Server |
|
|
LPR Port Monitor |
LPR-Port-Monitor |
|
|
Storage Manager for SANs |
Storage-Mgr-SANS |
|
|
BITS Server Extensions |
BITS |
|
|
Message Queuing |
|
Message Queuing Services |
|
Message Queuing Server |
|
Directory Service Integration |
|
Message Queuing Triggers |
|
HTTP Support |
|
Multicasting Support |
|
Routing Service |
|
Windows 2000 Client Support |
|
Messaging Queue DCOM Proxy | |
|
MSMQ |
|
MSMQ-Services |
|
MSMQ-Server |
|
MSMQ-Directory |
|
MSMQ-Triggers |
|
MSMQ-HTTP-Support |
|
MSMQ-Multicasting |
|
MSMQ-Routing |
|
MSMQ-Win2000 |
|
MSMQ-DCOM | |
|
|
Windows Process Activation Service |
|
Process Model |
|
.NET Environment |
|
Configuration APIs | |
|
WAS |
|
WAS-Process-Model |
|
WAS-NET-Environment |
|
WAS-Config-APIs | |
|
|
Windows Internal Database |
Windows-Internal-DB |
|
|
BitLocker Drive Encryption |
BitLocker |
|
|
Multipath I/O |
Multipath-IO |
|
|
Internet Storage Naming Server |
ISNS |
|
|
Removable Storage Manager |
Removable-Storage |
|
|
TFTP Client |
TFTP-Client |
|
|
SNMP Services |
|
SNMP Service |
|
SNMP WMI Provider | |
|
SNMP-Services |
|
SNMP-Service |
|
SNMP-WMI-Provider | |
|
|
Services for Network File System |
NFS-Services |
Services for Network File System is available as a feature only on the Windows Server 2008 IA64 version. On other versions of Windows Server 2008, it is available as a role service of File Services.
Services for Network File System jest dostępne jest funkcja tylko w wersji dla platformy IA64 Windows Server 2008.
W innych wersjach Windows Server 2008 jest ona dostępna jako rola File Services. |
|
Internet Printing Client |
Internet-Print-Client |
|
|
Peer Name Resolution Protocol |
PNRP |
|
|
Connection Manager Administration Kit |
CMAK |
|
|
Remote Server Administration Tools |
|
Role administration tools |
|
Active Directory Certificate Services |
|
Web Server (IIS) |
|
Terminal Services |
|
TS RemoteApp |
|
TS Gateway |
|
TS Licensing |
|
Feature administration tools |
|
Failover Clustering |
|
Network Load Balancing | |
|
RSAT |
|
RSAT-Role-Tools |
|
RSAT-ADCS |
|
RSAT-Web-Server |
|
RSAT-TS |
|
RSAT-TS-RemoteApp |
|
RSAT-TS-Gateway |
|
RSAT-TS-Licensing |
|
RSAT-Feature-Tools |
|
RSAT-Clustering |
|
RSAT-NLB |
|
|
|
Windows PowerShell |
PowerShell |
|
|
Group Policy Management |
GPMC |
|
|
Quality Windows Audio Video Experience |
Qwave |
|
Wnioski
Najważniejszym udogodnieniem dla administratorów jest niewątpliwie to, że nowe narzędzie można będzie zastosować w skryptach. Ułatwi to na przykład przygotowanie nowych podobnych funkcjonalnie środowisk, gdyż za pomocą plików odpowiedzi opartych na XML można będzie w prosty sposób zautomatyzować ten proces.