Presentation is loading. Please wait.

Presentation is loading. Please wait.

December, 21, 2010 Bartek Bielawski Sr IT Site Services Specialist Warsaw, Poland.

Similar presentations


Presentation on theme: "December, 21, 2010 Bartek Bielawski Sr IT Site Services Specialist Warsaw, Poland."— Presentation transcript:

1 December, 21, 2010 Bartek Bielawski Sr IT Site Services Specialist Warsaw, Poland

2

3 PowerShell IS: Automation engine Scripting language Interactive console To use it: Windows 7/ Windows Server 2008 R2 Windows XP + Windows Management Framework How pretty it can be? PowerShell.exe – cmd.exe revisited PowerShell ISE – notepad.exe on steroids PowerGUI – MMC + brilliant editor (3rd party) What is PowerShell and how can I get it?

4 PowerShell.exe/ PowerShell ISE/ PowerGUI + PowerGUI editor Hosts Demo

5 Easy switch: Cmd.exe – just launch powershell instead Aliases/ functions to make it easier for us *nix have their set of aliases too ‘Old’ commands still work! Switch from cmd.exe or *nix shell

6 Discover: Get-Verb + Guess Noun Syntax almost like sentence: Get-Process | Where { $_.WorkingSet –gt 100MB } | Stop-Process -Whatif Meaningful parameters disambiguate it Tab Completion Verb-Noun to guess command

7 PartsPropertiesPartsProperties Front Wheel Back Wheel PedalsPedals SaddleSaddle FrameFrame How to use Methods Methods PedalPedal Steer Left Steer Right Apply Front Brake Apply Rear Brake PartsParts How to use Objects - what they are?

8 DisplayNameDisplayName PartsPropertiesPartsProperties StatusStatus RequiredServicesRequiredServices Stop()Stop() How to use Methods Methods Start()Start() Pause()Pause() WindowsServiceWindowsService Objects – what they are in ‘Our’ world?

9 PowerShell objects: Microsoft.NET objects COM objects WMI Objects AD Objects Variables Single ver. Array Foreach as a key to collection Tab to help us see interior Methods definitions using name without () Objects all around

10 Get-Process | Where { $_.handles –gt 500 } | Sort handles | Format-Table Get-Process Cmdlet Common Windows PowerShell Parser Windows PowerShell Pipeline Processor Where Cmdlet Sort Cmdlet Format Cmdlet Pipeline

11

12 What it can do for me? List commands (functions, aliases, cmdlets, ‘legacy’ commands) Show definition Show parameters How I can use it? New module – what does it contain? Bell rings – what was this cmdlet name? I know Verbs, I know Nouns, need command! Get-Command to know what to look for

13 Easy: My-Command -? Basic description Definition to know parameter names Related links to dig more Everything: Get-Help My-Command -full Tons of info Examples Parameters descriptions Parts: -Examples, -Parameter My-Parameter Examples to try and learn Parameter description to understand what I need to get my results Get-Help ask PowerShell first

14 Too many objects Hard to remember properties/ method names Even harder to know how to use those Useful to see what’s inside Common use cases: COM objects (Excel.Application) To see if we got what we expected To get static methods of.NET classes Why? Helps when interactive We save our memory Can discover not documented objects Get-Member objects under the lens

15

16 WMI? MS implementation of CIM Lot of information about hardware/ software and more Available using RPC Why? Inventory Ad-hoc administration (services, processes, and God-knows-what) How? Get-WMIObject (alias gwmi) Invoke-WmiMethod (alias iwmi) -List to list, asterisk to list more… Demo WMI

17 Quest – 3rd party Very easy, very handy Requires install on our box Demo MS ActiveDirectory module Not as easy Currently only W7 or W2k8 R2 (using RSAT) AD

18 PSProviders and PSDrives (Almost) everything is a drive Browse registry as file system Wonderful asterisk support Quick ways to filter stuff *-EventLog Get, Limit – both local and remote Great for quick look and decent reports *.log Select-string and regular expressions Files, registry, event logs…

19 VMWare NetApp Exchange SharePoint SQL IIS SCCM.. And more to come! ;) What else?

20

21 Check it first What if? Please ask me to confirm… Build from floor to roof First get, then filter, than format/ output/ set Check each step as you go -WhatIf or –Confirm to avoid problems Save good lines and reuse them later To be on the safe side…

22 Forums TechNet PowerShellCommunity.org Twitter Tag #PowerShell Enjoy and learn, or opposite ;) On your own Free eBooks (Master PowerShell, PowerShell TFM 2nd ed, and others) Ask PowerShell (Get-Help, -Online, F1 in PowerShell ISE) Blogs, blogs, blogs Podcasts (PowerScripting Podcast, Get-Scripting Podcast) Help!

23


Download ppt "December, 21, 2010 Bartek Bielawski Sr IT Site Services Specialist Warsaw, Poland."

Similar presentations


Ads by Google