Download presentation
Presentation is loading. Please wait.
Published byRobert Foster Modified over 9 years ago
1
PowerShell for Dummies Kurt Callemin
2
WHO AM I ? Kurt Callemin Final year student at KHBO: Master of Science Electronics- ICT Microsoft Student Partner since 2009 Developer Blog: http://www.ckurt.net Blog: http://www.ckurt.net Yelper: http://www.yelper.be/C_Kurt Yelper: http://www.yelper.be/C_Kurt Twitter: C_Kurt Twitter: C_Kurt 2
3
AGENDA Introduction to PowerShell Learn to investigate and explore PowerShell Drill into utilities cmdlets 3
4
WINDOWS POWERSHELL 4 New command line and scripting language Interactive and Composable Programmatic Production Oriented
5
PRODUCTIVITY 5 Exchange 2003 (VBScript)Exchange 2007 Mailbox Statistics Set listExchange_Mailboxs = GetObject("winmgmts:{impersonationLevel=impersonate}!\\COMPUTERNAME\ROOT\MicrosoftExchangeV2").InstancesOf("Exch ange_Mailbox") For Each objExchange_Mailbox in listExchange_Mailboxs WScript.echo "AssocContentCount =” + objExchange_Mailbox.AssocContentCount WScript.echo " DateDiscoveredAbsentInDS =” + objExchange_Mailbox.DateDiscoveredAbsentInDS WScript.echo " DeletedMessageSizeExtended =” + objExchange_Mailbox. DeletedMessageSizeExtended WScript.echo " LastLoggedOnUserAccount =” + objExchange_Mailbox. LastLoggedOnUserAccount WScript.echo " LastLogoffTime =” + objExchange_Mailbox. LastLogoffTime WScript.echo " LastLogonTime =” + objExchange_Mailbox. LastLogonTime WScript.echo " LegacyDN =” + objExchange_Mailbox. LegacyDN WScript.echo " MailboxDisplayName =” + objExchange_Mailbox. MailboxDisplayName WScript.echo " MailboxGUID =” + objExchange_Mailbox. MailboxGUID WScript.echo " ServerName =” + objExchange_Mailbox. ServerName WScript.echo " Size =” + objExchange_Mailbox. Size WScript.echo " StorageGroupName =” + objExchange_Mailbox. StorageGroupName WScript.echo " StorageLimitInfo =” + objExchange_Mailbox. StorageLimitInfo WScript.echo " StoreName =” + objExchange_Mailbox. StoreName WScript.echo " TotalItems =” + objExchange_Mailbox. TotalItems Next get-mailboxstatistics –server $servername Recipient Mgmt Dim objMailbox As CDOEXM.IMailboxStore Set objMailbox = GetObject("LDAP://" + DCServer + "CN=FOO,CN=users," + DomainName) objMailbox.CreateMailbox "LDAP://" + DCServer + "/CN=Private MDB,CN=First Storage Group,CN=InformationStore,CN=" + Server + ",CN=Servers,CN=First Administrative Group, CN=Administrative Groups,CN=First Organization, CN=Microsoft Exchange,CN=Services, CN=Configuration," + DomainName enable-mailbox -identity domain\FOO –database “First Storage Group\Private MDB”
6
Short Introduction 6
7
OBJECTS 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 “An object is a collection of parts and how to use them” 7
8
OBJECTS DisplayNameDisplayName PartsPropertiesPartsProperties StatusStatus RequiredServicesRequiredServices Stop()Stop() How to use Methods Methods Start()Start() Pause()Pause() WindowsServiceWindowsService 8
9
ARRAYS Data structure that holds other objects Each object in its own compartment Access compartments using [] $Processes = Get-Process $Processes[0].name $Processes[4].name ObjectObjectObjectObjectObjectObjectObjectObject ObjectObject 9
10
THE KIND OF OBJECTS 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 10
11
Working with Objects 11
12
LEARN AND LEVERAGE In the box documents PowerShell_ISE Help Getting Started User’s Guide About Help Cmdlet Help Provider Help Discovery utilities Books Community Practice ad hoc development 12
13
UTILITIES - DISCOVERY CommandFunction Get-HelpHelp about PowerShell commands and topics Get-CommandGet information about anything that can be invoked Get-MemberShow what can be done with an object Get-PSDriveShows what object stores are available Get-ModuleShows packages of commands 13
14
Discovery Utilities 14
15
Utilities – Object Manipulation CommandAction CompareCompare 2 sets of objects ForeachAct on each element of a set GroupSplit a set of objects into groups MeasureMeasure some property of a set of objects SelectSelect a set of properties from a set of objects SortSort objects TeeMake a copy of a set of objects WhereSelect a subset of objects 15
16
Object Manipulation Utilities 16
17
TRANSFORMATION and OUTPUT CommandsFunctions Format -Custom -List -Table -Wide Convert objects into formatting records Out -File -GridView -Host -Printer -String Convert formatting records into output-specific directives. Export/Import -CliXML -CSV Converts objects into and out of file formats ConvertTo -CSV -HTML -XML Converts object into other objects 17
18
Transformation and Output Utilities 18
19
Summary Now available at: www.microsoft.com/downloadswww.microsoft.com/downloads Search for PowerShell Try it, Deploy it, Use it, Share More Sessions: Scripting http://www.msteched.com/2010/NorthAmerica/WSV401 http://www.msteched.com/2010/NorthAmerica/OSP402 19
20
POWERSHELL COMMUNITY Newsgroup: Microsoft.Public.Windows.PowerShell Team blog: http://blogs.msdn.com/PowerShell/http://blogs.msdn.com/PowerShell/ PowerShellCommunity.Org: http://www.PowershellCommunity.Orghttp://www.PowershellCommunity.Org Channel 9 http://channel9.msdn.com/tags/PowerShellhttp://channel9.msdn.com/tags/PowerShell Wiki http://channel9.msdn.com/wiki/default.aspx/Channel9.WindowsPowerShellWiki Script Center: http://www.microsoft.com/technet/scriptcenter/hubs/msh.mspxhttp://www.microsoft.com/technet/scriptcenter/hubs/msh.mspx CodePlex: http://codeplex.com/Project/ProjectDirectory.aspx?TagName=powershell Many excellent books Manning Press book by PowerShell Dev Lead Bruce Payette: PowerShell in Action http://manning.com/powershell/http://manning.com/powershell/ O’Reilly book by PowerShell Dev Lee Holmes – Windows PowerShell Cookbook http://www.oreilly.com/catalog/9780596528492/index.html 20
21
Thank you! Please fill out session evaluations 21
22
Sponsored by:
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.