Download presentation
Presentation is loading. Please wait.
Published byCynthia O’Neal’ Modified over 9 years ago
1
PowerShell for IT Administrators Richard Siddaway Perot Systems
2
Welcome to this TechNet Event “Pick your Own Collateral” URL for on-line feedback is in your reminder e-mail No Planned Fire Drills Please turn your Mobile Phones off To find out about future TechNet events: www.microsoft.com/uk/technetevents www.microsoft.com/uk/technetevents
3
The TechNet Programme A range of tools and resources for IT Professionals FREE TechNet Newsletter FREE Events and Webcasts FREE TechNet BETA Central (www.microsoft.com/uk/betacentral) FREE Quarterly TechNet Magazine FREE comprehensive technical website FREE TechNet Radio, Security Centre, Learning Paths and Virtual Labs TechNet Plus – Now available for Download! www.microsoft.com/technet
4
What is TechNet Plus? The Toolkit for IT Professionals TechNet Plus is an annual subscription Access to TechNet Knowledge Base No-limits Evaluation software for Testing Beta software available immediately 2 Free Technical Support calls worth £320 20% off all further Support Calls Managed Newsgroups with guaranteed answers in 24hrs Now available by Download from only £230 / year (excl VAT) For all information on TechNet Plus Subscriptions visit: www.microsoft.com/technet/abouttn/subscriptions
5
Who am I? IT Architect and systems integrator Programming with.NET for several years Scripting with VBScript since NT 4 VERY interested in automation Using PowerShell since beta 2 (Monad) Run UK PowerShell User Group Think PowerShell is one of best pieces of technology EVER!
6
Agenda What is PowerShell? Learning PowerShell Administration of Windows systems Administration of Active Directory Administration of Exchange 2007 Administration of SQL Server 2005
7
Agenda What is PowerShell? Learning PowerShell Administration of Windows systems Administration of Active Directory Administration of Exchange 2007 Administration of SQL Server 2005
8
PowerShell Next generation shell that is: As interactive and composable as BASH/KSH As programmatic as Perl/Ruby As production oriented as AS400 CL/VMS DCL Access data stores as easily as accessing filesystems ExtensibleSnapinsProvidersScripts
9
Script Types Text.Net “interpretation” of the traditional Unix scripting model COM WSH/VBScript style scripting.NET Manipulate any native.Net object Commands Powershell cmdlets emitting objects
10
DataTypes Flat File – CSV etc.NETXMLWMIADSIADOADO.NETSQL
11
Accessing.NET Simple scripts need [STRING] and [MATH] Advanced scripts can use any.NET object Cmdlets provide the best admin and scripting experience.NET provides a safety net of coverage PowerShell provides access to the entirety of the.NET Framework
12
Windows Server System Security Infrastructure IT Operations Infrastructure Applications Infrastructure Collaboration Infrastructure
13
Agenda What is PowerShell? Learning PowerShell Administration of windows systems Administration of Active Directory Administration of Exchange 2007 Administration of SQL Server 2005
14
Learning and Leveraging In the Box Documents Getting Started, Users Guide, Quick Reference Guide HelpBooks Invest in your integrated lifetime earnings Community A wise man learns from mistakes… Practice ad hoc development
15
Try things out in an interactive shell Stitch things together with utilities Put the results in a script file Realize that the tools are unsuitable and restart with a new set of tools Generalize (e.g., parameterize) Clean it up production-quality Integrate into your environment Share with the community Ad Hoc Development
16
UtilitiesDiscovery Get-Help, Get-Member, Get-Command Object Manipulation Compare, Group, Measure, Select, Sort, Tee, Where Formatting Format-(Custom, List, Table, Wide) Out-(File, Host, Printer, String) Export/Import-(Clixml, CSV) ConvertTo-Html
17
Primary Concepts Cmdlets Verb-noun naming Specific functionality Pipeline.NET based objects NOT text Help is text based Syntax is similar to C# Data – CSV, XML, SQL WMI etc
18
Issues Default install mode won’t run scripts Set-ExecutionPolicy No file association Can’t automatically run scripts Can’t double click script to run it No remoting – yet Can use.NET and WMI Current working directory is NOT on PATH.\myscript.ps1 Does not load all.NET assemblies Use [Reflection.Assembly]::LoadWithPartialName(" Microsoft.SqlServer.Smo ")
19
Learning PowerShell Demo
20
Agenda What is PowerShell? Learning PowerShell Administration of Windows systems Administration of Active Directory Administration of Exchange 2007 Administration of SQL Server 2005
21
Administering Windows Some administrative cmdlets EventlogsServicesProcessesWMIScripting
22
Administering Windows Demo
23
Agenda What is PowerShell? Learning PowerShell Administration of Windows systems Administration of Active Directory Administration of Exchange 2007 Administration of SQL Server 2005
24
PowerShell and Active Directory NO AD support in PowerShell v1 Exchange 2007 has limited AD support Quest AD cmdlets Currently Beta Quest PowerGUI PowerShell Community Extensions Scripting
25
Active Directory Provider PowerShell Community Extensions Access AD as “filesystem” Navigation Use core commands Interactive or scripting Associated cmdlets Issues – “open source”
26
Administering Active Directory Demo
27
Agenda What is PowerShell? Learning PowerShell Administration of Windows systems Administration of Active Directory Administration of Exchange 2007 Administration of SQL Server 2005
28
Exchange Management Exchange Information no longer visible in Active Directory Users and Computers May need to rethink administrative tasks Exchange Management Console creates, uses and shows PowerShell scripts of actions Cannot perform all actions in GUI Administrative development model
29
Administrative Development Use the GUI Copy the script Modify Use cmdlets Create pipeline Put into script
30
Exchange Management Shell PowerShell is pre-requisite for Exchange 2007 install EMS = PowerShell + Exchange PowerShell snapin Both coexist EMS adds 300+ cmdlets
31
Administering Exchange 2007 Demo
32
Agenda What is PowerShell? Learning PowerShell Administration of Windows systems Administration of Active Directory Administration of Exchange 2007 Administration of SQL Server 2005
33
Administering non-PowerShell enabled applications Needs a.NET API SQL Server SharePoint SQL Server 2005 SMO = Server Management Objects Need to use.NET
34
SQL Server SMO Programmatic administration.NET object model Examples in C# Tasks View status Access data Perform backups
35
Administering SQL Server 2005 Demo
36
Summary/Call to Action PowerShell can be used to administer large and growing parts of your environment Now available at: www.microsoft.com/downloads www.microsoft.com/downloads Search for PowerShell Try it, Deploy it, Use it, Share
37
For More Information User group: http://www.get-psuguk.org.uk My Blog http://richardsiddaway.spaces.live.com Get-PSUGUK UK PowerShell User Group
38
Downloads Quest AD cmdlets: http://www.quest.com/activeroles- server/arms.aspx http://www.quest.com/activeroles- server/arms.aspx Quest PowerGUI http://www.powergui.org PowerShell Community Extensions http://www.codeplex.com/Wiki/View.aspx?Pr ojectName=PowerShellCX http://www.codeplex.com/Wiki/View.aspx?Pr ojectName=PowerShellCX
39
Community Resources Newsgroup: Microsoft.Public.Windows.PowerShell Team blog: http://blogs.msdn.com/PowerShell/ http://blogs.msdn.com/PowerShell/ Channel 9 tag: http://channel9.msdn.com/tags/PowerShell http://channel9.msdn.com/tags/PowerShell Wiki: http://channel9.msdn.com/wiki/default.aspx/Channel9.WindowsPowerShell Wiki Script Center: http://www.microsoft.com/technet/scriptcenter/hubs/msh.mspx Manning Press book by Bruce Payette: PowerShell in Action http://manning.com/powershell/ O’Reilly book – Monad: Introducing the MSH Command Shell and Language http://www.oreilly.com/catalog/msh/ Sapien Press book by Don Jones: PowerShell http://www.sapienpress.com/ MshAnalyzer tool http://www.karlprosser.com/coder/?cat=8
40
Resources Technical Chats and Webcasts http://www.microsoft.com/communities/chats/default.mspx http://www.microsoft.com/usa/webcasts/default.asp Microsoft Learning and Certification http://www.microsoft.com/learning/default.mspx MSDN & TechNet http://microsoft.com/msdn http://microsoft.com/technet Virtual Labs http://www.microsoft.com/technet/traincert/virtuallab/rms.mspx Newsgroups http://communities2.microsoft.com/ communities/newsgroups/en-us/default.aspx Technical Community Sites http://www.microsoft.com/communities/default.mspx User Groups http://www.microsoft.com/communities/usergroups/default.mspx
41
Any Questions? PowerShell-uk@hotmail.co.uk
42
Ihr Potenzial. Unser Antrieb. Thank you for attending this TechNet Event Find these slides at: http://www.microsoft.com/uk/technetslides
43
Reference Slides
44
Scripting with COM Access existing instrumentation Bind to COM objects $fso = New-Object -ComObject Scripting.FileSystemObject $m = [System.Runtime.InteropServices.Marshal] $word = $m::GetActiveObject("Word.Application") Invoke methods/access properties $fso.GetDrive(“C:”) $fso.VolumeName = “System Drive” Understand/extend instrumentation Extend and discover properties/methods Update-TypeData Office.Word.Types.ps1xml $fso | Get-Member Manipulate and format results Define and import custom formating Update-FormatData Office.Word.Format.ps1xml $word.RecentFiles | Sort name | Format-Table Allows more simpler/more powerful COM scripts because of utilities and formatting
45
Scripting with WMI PowerShell provides native WMI support Get-WmiObject Allows for inspection of WMI namespace Get-WmiObject –list [-Namespace xx] Get-WmiObject –Class xx –Namespace xx –Property xxx – Filter xxx –ComputerName xxx –Credential xxx Native language support [WMI] “\\JPSDESK10\root\cimv2:Win32_Process.Handle="0“ \\JPSDESK10\root\cimv2:Win32_Process.Handle="0 [WMICLASS] "ROOT\cimv2:WIN32_PROCESS" [WMISEARCHER]"select * from Win32_process WHERE Name = 'calc.exe'"
46
Scripting with.NET PowerShell provides native access to any.NET class Create any object [reflection.assembly]::LoadWithPartialName("System.Wind ows.Forms") $d = New-Object System.DateTime 2006,12,25 Access Properties/Invoke Methods $d.DayOfWeek$d.AddDays(-30) Access Statics [DateTime]::Now[DateTime]::IsLeapYear(2006) Allows admins to easily access and leverage a huge API set because of scriptability, utilities and formatting
47
Scripting with XML PowerShell provides native XML support Native datatype $x=[xml]"<a><b><c>TEST</c></b></a>“ $b =[xml](type c:\i386\mssecure.xml) Native syntax to access “data” view of properties $b.BulletinDataStore.Bulletins.Bulletin[0] Access to XML methods $b.BulletinDataStore.SelectNodes(“//Patch”) XML properties available through PSBase property $b.BulletinDataStore.PSBase.innerXml
48
Scripting with Text Invoke existing tools Existing command run directly after variables are expanded Harvest data from existing tools Parse output into variables using text utilities. Pipe data to SELECT and use –FIRST and –LAST Select-String Select-String Dir | Select-String Dir | Select-String [DateTime]”12/25/2006 7:00” ([DateTime]”12/25/2006 7:00”).AddDays(-30) Use functions/scripts to wrap the commands and convert output to objects or provide standard syntax Safely process text Use CLR types via Windows PowerShell to safely parse text [URI]” http://blogs.msdn.com/powershell/archive/2006/04/25/583234.aspx” Allows admins to get 2-10x more power out of existing commands because of scriptability
49
Slide Guidelines Slides should emphasize key points Limit to 6 lines per slides Font, size, and color for text have been formatted for you in the Slide Master Colours:
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.