what’s new in powershell v3 and introducing script explorer
DESCRIPTION
Presentation to NEBytes user group on 18th January 2012. Audience was mixed IT pro/developer; 1/4 people who have used PowerShell to some degree; 2/3 had at least some awareness. The aim of the presentation was to show existing PowerShell users some of the exciting new features/directions, and persuade the rest that PowerShell has come of age and is a technology that they should be exploring.TRANSCRIPT
What’s New in PowerShell v3
Disclaimer:All of this is pre-release
functionality and is subject to change
@jonoble
Automating all management operations for servers within an organization increases the quality and reliability of the operations and lowers the total cost of ownership. Windows PowerShell scripting is the Microsoft standard for automation. Windows PowerShell enables IT pros to automate operations such as deployment, configuration, life cycle management, data management, security management, and diagnostics. Microsoft server products provide high-level, task-oriented Windows PowerShell cmdlets and optional namespace providers. Microsoft Common Engineering Criteria
Masses of ModulesAppLocker
BestPractices BitsTransfer
BranchCache ClusterAwareUpdating
DirectAccessClientComponentsDnsConfig DnsLookup
FailoverClustersFileServer
iSCSI MsDtc
NetAdapter NetQos
NetSwitchTeamNetTCPIP
NetworkConnectivityStatus NetworkSecurity
PKIClientPrintManagement PSScheduledJob
PSWorkflow RDManagement ScheduledTasks
SecureBootServerManager
SmbShare SmbWitness
Storage TelemetryManagementTroubleshootingPack
TrustedPlatformModuleUserAccessLogging
…and more!
Feature Specific Modulesor added with RSAT
ActiveDirectoryADDSDeployment
ADRMSAdminDhcpServerDnsServer
GroupPolicyNetworkLoadBalancingClusters
RemoteAccess
Active Directory
• 76 cmdlets on Server 2008 R2• 134 on Server 8
support for managing…Active Directory replication, sites, site links,
subnets
Central Access Policies, Rules, Claims
• ADDSDeployment module contains cmdlets to replace dcpromo
• ADDS Installation Wizard and ADAC expose the PowerShell they use in the background
Remoting
• Enabled on Server 8 by default
• Server Manager allows management of multiple machines using PowerShell Remoting and WMI
• Add Roles/Features wizards can act against multiple targets
Remoting Improvements
• New configuration optionsSharedHostsRunasUserAutoRestartServerBufferingMode
• Disconnected sessions• Resilient sessions
• New cmdlets that make creation of restricted sessions easier
Workflow
• Based on Windows Workflow Foundation
• Run complex, large, multi-machine management tasksRepeatableParallelizableInterruptibleRecoverable
• Resume after reboot, network/power loss
• RunBook automation
Workflow
• Look a lot like functions• Runs on top of PowerShell job engine• Use *-Job cmdlets• Parallel and Sequence blocks• Can be nested
• Check out the PDF with WMF3 CTP2
Workflow Language Differences
• Adds Workflow specific parallel ForEach statement and Parallel keyword
• You can’t use these within WorkflowSwitch statements (except basic string comparisons)Begin, Process and EndIn loops: Break, Continue, variable modifying conditionsSub expressionsMultiple assignmentsDynamic parametersDot-sourcing or the invocation operatorPositional parameters
Simplified Syntax(try saying that ten times quickly after a few drinks!)
• Where-Object {$_.<propertyname>}• Where-Object <propertyname>
Get-CASMailbox | Where {$_.IMAPEnabled}becomes
Get-CASMailbox | Where IMAPEnabled
• Now works like Sort-Object, Group-Object
Other New Stuff
• Export-Csv now has an –Append switchRequires matching headings in the fileUnless you use –Force
• Get-ChildItem has new filter parameters-Directory, -File, -Attributes [<FileAttributes>]
• New operators-in and –notinLike –contains and –notcontains in reverse
Other New Stuff
• PowerShell Jobs can be scheduledOn a timescaleIn response to an event
• Automatic module loading makes cmdlet discovery easierBe careful about duplicate cmdlets
Set your PSModulePath
• Show-Command
• Updatable help
Other New Stuff
• Restart-Computer has new parameters-Wait-For <Wmi|WinRM|PowerShell>
• Invoke-RestMethod• ConvertFrom/To-Json
• Better control passing arguments to exes--% to dumb-down parser
DLR
POWERSHELL IS NOW BASED ON THE DYNAMIC LANGUAGE RUNTIME!!!
ISE Enhancements
• F8• Better IntelliSense• Add-ons
Horizontal/vertical tool pane
• XML File highlighting• Script region folding• Code snippets• Auto-save• Recent file list
• PowerShell Magazine articlehttp://www.powershellmagazine.com/2011/09/28/powershell-v3-ise-and-ise-scripting-model-changes-improvements/
PowerShell Web Access
• Gives a remote console in a browser
• Runs on IIS, over SSL• Just add feature & run a script to
configure
• Blog post by Jan Egil Ringhttp://blog.powershell.no/2011/09/14/windows-powershell-web-access/
Introducing Script Explorer
…or to be preciseMicrosoft Script Explorer for
Windows PowerShell
• Standalone or ISE add-on
• Online repositories• Local file system and network shares
• Search or browse• Scripts, snippets or how-to
• Save to local file or copy to ISE editor
• Explore community resources
• Any questions?
• NE PowerShell Script Club, anyone?