Dueling Command Lines in Windows Server 2008 ? .. or a happy end ?
Paul Thurrott wrote a nice article about PowerShell and CMD support in Windows Server 2008
Dueling Command Lines in Windows Server 2008
except for my toughts about the outcome I found it a excelent article, with a great start :
In this corner, in the black trunks, we have the reigning champion, that last unwelcome reminder of MS-DOS still lingering in our beloved NT-based operating system. You know him as cmd.exe, the Windows Command Prompt. [Cheers, boos erupt from the audience.]
In the other corner, in the newish-looking navy blue trunks, we have the cocky young newcomer, a .NET-based based bit of developer mashup that admins both fear and respect. He's the Windows PowerShell, and he's breathing down CMD's aging virtual neck like a freight train barreling down the track. [Scattered cheers, noncommittal murmuring as audience members look askance to see if everyone else there is as unclear about PowerShell as they are.]
after that he explains why CMD still sort-a-win's ,one of is arguments are the newcommandline utilities in Windows Server 2008
He took :
servermanagercmd.exe
as an example, ... and giving me a shot before open goal ;-) ,
let me expain that bit more :
First of course, you can start the commandline utilities the same way in PowerShell and CMD,
(in the output below I use PowerTab , my own tabexpansion addition , to find and start ServerManagerCmd using tabcompletion, without that you have to type it in completely, but for the rest this is all standard PowerShell )
but now try to get help on servermanagerCmd.exe,
see we can just use -? as we do in PowerShell
Yes ! ServerManagerCmd uses dashes for it's parameters, but even more, as we look at the end of the helpoutput (removed from example for length )
we see this :
Examples:
ServerManagerCmd.exe -query
ServerManagerCmd.exe -install Web-Server -resultPath installResult.xml
ServerManagerCmd.exe -inputPath install.xml -whatIf
ServerManagerCmd does even support the PowerShell standard parameter -WhatIf !!!!
And another thing is the XML output that ServerManagerCmd produces for example as shown bleow on the -Query parameter, but also the results of configuration task are exported this way, so we not need to parse the logs anymore, with the standard XML support in powershell we can grab and start using it like an Object with a simple statement like this :
$query = [xml](get-content query.xml)
now it get's all the standard PowerShell formatting and we can use all the standard PowerShell utilities on it
$query.ServerManagerConfigurationQuery.role
In the output from the PowerShell session below (removed part of output and helptext ) you can see an example how this works, note that we can also shorten -query to -q as in powershell
PoSH> Server!
PoSH> Server
PoSH> ServerCeipOptin.exe
PoSH> ServerManager.msc
PoSH> ServerManagerCmd.exe
PoSH> ServerManagerLauncher.exe
PoSH> ServerWerOptin.exe
PoSH> [ 3 of 5 ]
PoSH> ServerManagerCmd.exe -?
PoSH> ServerManagerCmd.exe -q query.xml
Starting discovery
.....................
Discovery complete.
----- Roles -----
[ ] Active Directory Certificate Services [AD-Certificate]
[ ] Certification Authority [ADCS-Cert-Authority]
[ ] Certification Authority Web Enrollment
[X] Active Directory Domain Services
[X] Active Directory Domain Controller [ADDS-Domain-Controller]
[ ] Identity Management for UNIX [ADDS-Identity-Mgmt]
[ ] Server for Network Information Services [ADDS-NIS]
[ ] Password Synchronization [ADDS-Password-Sync]
[ ] Active Directory Federation Services
[ ] AD FS Web Agents [ADFS-Web-Agents]
...[Web-Windows-Auth]
[ ] Digest Authentication [Web-Digest-Auth]
[ ] Client Certificate Mapping Authentication [Web-Client-Auth]
[ ] IIS Client Certificate Mapping Authentication [Web-Cert-Auth]
[ ] URL Authorization [Web-Url-Auth]
[X] Request Filtering [Web-Filtering]
[ ] IP and Domain Restrictions [Web-IP-Security]
[X] Performance [Web-Performance]
[X] Static Content Compression [Web-Stat-Compression]
[ ] Dynamic Content Compression [Web-Dyn-Compression]
[X] Management Tools [Web-Mgmt-Tools]
[X] IIS Management Console [Web-Mgmt-Console]
[ ] IIS Management Scripts and Tools [Web-Scripting-Tools]
[ ] Management Service [Web-Mgmt-Service]
[ ] IIS 6 Management Compatibility [Web-Mgmt-Compat]
[ ] IIS 6 Metabase Compatibility [Web-Metabase]
[ ] IIS 6 WMI Compatibility [Web-WMI]
[ ] IIS 6 Scripting Tools [Web-Lgcy-Scripting]
[ ] IIS 6 Management Console [Web-Lgcy-Mgmt-Console]
[ ] FTP Publishing Service [Web-Ftp-Publishing]
[ ] FTP Server [Web-Ftp-Server]
[ ] FTP Management snap-in [Web-Ftp-Mgmt-Console]
[ ] Windows Deployment Services [WDS]
[ ] Deployment Server [WDS-Deployment]
[ ] Transport Server [WDS-Transport]
[ ] Windows SharePoint Services [Windows-SharePoint]
----- Features -----
[ ] .NET Framework 3.0 [NET-Framework]
[ ] .NET Framework 3.0 Features [NET-Framework-Core]
[ ] XPS Viewer [NET-XPS-Viewer]
[ ] Windows Communication Foundation Activation Components [NET-Win-CFAC]
[ ] HTTP Activation [NET-HTTP-Activation]
[ ] Non-HTTP Activation [NET-Non-HTTP-Activ]
[ ] BitLocker Drive Encryption [BitLocker]
[ ] BITS Server Extensions [BITS]
[ ] Connection Manager Administration Kit [CMAK]
[X] Desktop Experience [Desktop-Experience]
[X] Group Policy Management [GPMC]
[ ] Internet Printing Client [Internet-Print-Client]
[ ] Internet Storage Naming Server [ISNS]
[ ] LPR Port Monitor [LPR-Port-Monitor]
...
[ ] Network Load Balancing [NLB]
[ ] Peer Name Resolution Protocol [PNRP]
[ ] Quality Windows Audio Video Experience [qWave]
[ ] Remote Assistance [Remote-Assistance]
[X] Remote Server Administration Tools [RSAT]
[X] Role Administration Tools [RSAT-Role-Tools]
[ ] Active Directory Domain Services [RSAT-ADDS]
[ ] Active Directory Lightweight Directory Services [RSAT-ADLDS]
[ ] Active Directory Rights Management Services [RSAT-RMS]
[ ] DNS Server [RSAT-DNS-Server]
[ ] Fax Server [RSAT-Fax]
[ ] File Services [RSAT-File-Services]
[ ] DFS Management Console [RSAT-DFS-Mgnt-Con]
[ ] File Server Resource Manager Management Console [RSAT-FSRM-Mg
nt]
[ ] Services for Network File System [RSAT-NFS-Admin]
[ ] Network Policy and Access Services [RSAT-NPAS]
[ ] Network Policy Server [RSAT-NPS]
[ ] Health Registration Authority [RSAT-HRA]
[ ] Print Services [RSAT-Print-Services]
[ ] Terminal Services [RSAT-TS]
[ ] TS RemoteApp Manager [RSAT-Term-Server]
[ ] TS Gateway Manager [RSAT-TS-Gateway]
[ ] TS Licensing Manager [RSAT-TS-Licensing]
[X] Web Server (IIS) [RSAT-Web-Server]
[ ] Windows Deployment Services [RSAT-WDS]
[ ] Feature Administration Tools [RSAT-Feature-Tools]
[ ] BitLocker Drive Encryption [RSAT-BitLocker]
[ ] BITS Server Extensions [RSAT-Bits-Server]
[ ] Failover Clustering [RSAT-Clustering]
[ ] Network Load Balancing [RSAT-NLB]
[ ] SMTP Server [RSAT-SMTP]
[ ] Windows System Resource Manager [RSAT-WSRM]
[ ] Removable Storage Manager [Removable-Storage]
[ ] RPC over HTTP Proxy [RPC-over-HTTP-Proxy]
[ ] Simple TCP/IP Services [Simple-TCPIP]
[ ] SMTP Server [SMTP-Server]
[ ] SNMP Services [SNMP-Services]
[ ] SNMP Service [SNMP-Service]
[ ] SNMP WMI Provider [SNMP-WMI-Provider]
[ ] Storage Manager for SANs [Storage-Mgr-SANS]
[ ] Subsystem for UNIX-based Applications [Subsystem-UNIX-Apps]
[X] Telnet Client [Telnet-Client]
[ ] Telnet Server [Telnet-Server]
[ ] TFTP Client [TFTP-Client]
[ ] Windows Internal Database [Windows-Internal-DB]
[X] Windows PowerShell [PowerShell]
[X] Windows Process Activation Service [WAS]
[X] Process Model [WAS-Process-Model]
[ ] .NET Environment [WAS-NET-Environment]
[X] Configuration APIs [WAS-Config-APIs]
[ ] Windows Recovery Disc [Recovery-Disc]
[X] Windows Server Backup [Backup]
[ ] Windows System Resource Manager [WSRM]
[ ] WINS Server [WINS-Server]
[ ] Wireless Networking [Wireless-Networking]
PoSH> $query = [xml](get-content query.xml)
PoSH> $query
ServerManagerConfigurationQuery
-------------------------------
ServerManagerConfigurationQuery
PoSH> $query.ServerManagerConfigurationQuery
Time : 2007-05-23T19:49:28
Language : en-US
xmlns : http://schemas.microsoft.com/sdm/Windows/ServerManager/Configurati
on/2007/1
Role : {AD-Certificate, Active Directory Domain Services, Active Director
y Federation Services, ADLDS...}
Feature : {NET-Framework, BitLocker, BITS, CMAK...}
PoSH> $query.ServerManagerConfigurationQuery.role
DisplayName Installed Id RoleService
----------- --------- -- -----------
Active Directory... false AD-Certificate {ADCS-Cert-Auth...
Active Directory... true {ADDS-Domain-Co...
Active Directory... false RoleService
Active Directory... false ADLDS
Active Directory... false {Active Directo...
Application Server false Application-Server {AS-AppServer-C...
DHCP Server false DHCP
DNS Server true DNS
Fax Server false Fax
File Services true {FS-FileServer,...
Network Policy a... false NPAS {NPAS-Policy-Se...
Print Services false Print-Services {Print-Server, ...
Terminal Services false Terminal-Services {TS-Terminal-Se...
UDDI Services false
Web Server (IIS) true Web-Server {Web-WebServer,...
Windows Deployme... false WDS {WDS-Deployment...
Windows SharePoi... false Windows-SharePoint
PoSH>
How is that for a GlidePath into PowerShell ??
Ok, Ok, it sounds like a bad movie, but in the end the dualists shake hands, and combine there forces to make the Windows admin life much easier and more PoSH in the future.
Bad for a movie, good for an admin who can keep using his old stuff that he is confortable with and combine it with the new stuff to have an excelent glidepath.
Enjoy,
Greetings /\/\o\/\/
PS1 a bad thing I found in Windows 2008 Server beta 3, both for Cmd and PowerShell users, is that a lot of the shortcut exe's to controlpanel functionality in Windows Server 2008 do not listen for the /? or -? parameters at all ! and just fire up ;-(
PS2 Ssstt ... but he also can do windows forms but only if he really,really wanted too ;-)