2/28/11
Windows Command Line
System Admin II
Mark Stockman ©2011
Windows Command Line
• Oxymoron? • Why? • Original? • DOS • New? • PowerShell • cmd line AND real scripting !
PowerShell
• Legacy DOS/*nix commands • Piping • New Windows apps build on top • Object based • Requires .Net framework • XP/2k3 and above only (Server Core R2 only)
1 2/28/11
PowerShell
• dir/ls • history (F7) • auto complete • / or C: • pwd • | • cat/more • grep? • Select-String sometimes
PowerShell Cmdlet
• Now standardized! • verb-noun • get-command • get-command –Verb Get • get-command –Noun Service • get-help -full (in *nix?)
PowerShell Service Example
• Listing? • Information about? • Start/restart/stop? • Startup type?
2 2/28/11
PowerShell Aliases
• Alias? • Show them? • Set them? • Permanent? • Place in PowerShell profile
PowerShell Object
• Object? cd hkcu: • Methods/Properties get-service | get-member dir? • Why powerful? ls / -recurse | where-object {$_.LastWriteTime –gt “03/01/2009”}
PowerShell Output Formatting (Excel not needed! • Sorting/Grouping ls c:\windows | sort-object length -descending • Specialized output select-object/group-object (properties) format-table/format-list • Export output get-process | convertTo-html > file.html invoke-item file.html get-process | export-csv > file.csv
3 2/28/11
AD Management w/ PowerShell
• Why? • Examples
Server Core
• What/why? • All cli? • Manage how? • Blank password on install
Server Core net use administrator
4 2/28/11
Server Core netdom join
Lab
• PowerShell • Server Core
http://www.powershellpro.com/powershell-tutorial-introduction/ http://it.toolbox.com/blogs/techscrawl/2008-server-core-configuration-28070
5