<<

2/28/11

Windows 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 . framework • XP/2k3 and above only ( Core R2 only)

1 2/28/11

PowerShell

/ (F7) • auto complete • / or C: • • | • /? • Select-String sometimes

PowerShell Cmdlet

• Now standardized! • verb-noun • get-command • get-command –Verb Get • get-command –Noun Service • get- -full (in *nix?)

PowerShell Service Example

• Listing? • Information about? • /restart/stop? • Startup ?

2 2/28/11

PowerShell Aliases

? • Show them? • Set them? • Permanent? • Place in PowerShell profile

PowerShell Object

• Object? 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) -table/format-list • Export output get- | 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 netdom renamecomputer /NewName: control timedate.cpl interace ipv4 show interfaces netsh interface ipv4 set address name= source=static address= mask= gateway= netsh interface ipv4 add dnsserver name=“ address= index=1 slmgr.vbs –ato netsh firewall set opmode disable

4 2/28/11

Server Core netdom join /domain: /userD: / passwordD:* /SecurePasswordPrompt / /t 0 cscript c:\windows\system32\scregedit.wsf /AU 4 cscript c:\windows\system32\scregedit.wsf /AR 0 msiexec.exe /quiet /qn /i oclist start /w ocsetup

Lab

• PowerShell • Server Core

http://www.powershellpro.com/powershell-tutorial-introduction/ http://it.toolbox.com/blogs/techscrawl/2008-server-core-configuration-28070

5