Upload
holly-stephens
View
225
Download
0
Tags:
Embed Size (px)
Citation preview
1
Monad – A New Monad – A New Command Shell Command Shell
Jeffrey Snover, ArchitectJeffrey Snover, ArchitectJames Truher, Program ManagerJames Truher, Program ManagerTLN303TLN303Microsoft CorporationMicrosoft Corporation
2
Top 10 Developer Calls To ActionTop 10 Developer Calls To Action Follow the Windows Follow the Windows Vista style guidelinesVista style guidelines
Look like a great Windows Vista app by using the common file Look like a great Windows Vista app by using the common file dialogs, and providing high resolution live icons and preview dialogs, and providing high resolution live icons and preview controls for the shellcontrols for the shell
Enrich the user Enrich the user experienceexperience
Use Windows Presentation Foundation to create engaging, Use Windows Presentation Foundation to create engaging, scalable interfaces with multimedia, vector graphics and scalable interfaces with multimedia, vector graphics and animationanimation
Enable users to Enable users to visualize, search, and visualize, search, and organizeorganize
Provide metadata for your file formats and enable search and Provide metadata for your file formats and enable search and organize in your applicationsorganize in your applications
Run securelyRun securely Use least privilege user accounts and limit elevation requests; Use least privilege user accounts and limit elevation requests; express privilege demands and limitations using Code Access express privilege demands and limitations using Code Access SecuritySecurity
Design for reliability and Design for reliability and manageabilitymanageability
Use the new event logging and performance instrumentation Use the new event logging and performance instrumentation capabilities for monitoring, troubleshooting, and analysis of capabilities for monitoring, troubleshooting, and analysis of your application; make it easy to deploy and update by using your application; make it easy to deploy and update by using Windows Installer and ClickOnceWindows Installer and ClickOnce
Establish a customer Establish a customer feedback loopfeedback loop
Use the Windows Feedback Platform to log user errors, and Use the Windows Feedback Platform to log user errors, and Windows Developer Portal to analyze and fix themWindows Developer Portal to analyze and fix them
Build for connected systemsBuild for connected systems Use Windows Communication Foundation to build connected systems that Use Windows Communication Foundation to build connected systems that provide secure and reliable interoperability; take advantage of Windows provide secure and reliable interoperability; take advantage of Windows Workflow Foundation to enable flexible workflow in applicationsWorkflow Foundation to enable flexible workflow in applications
Bring data to the user with Bring data to the user with RSSRSS
Use the Windows Vista RSS common feedlist, shared data store, sync and Use the Windows Vista RSS common feedlist, shared data store, sync and parsing engine, and list extensions to RSS parsing engine, and list extensions to RSS
Make document data Make document data accessibleaccessible
Use the same open XML file format as XPS and Office "12” to make Use the same open XML file format as XPS and Office "12” to make documents easier for users to find, manage and integratedocuments easier for users to find, manage and integrate
Build for mobilityBuild for mobility Run great on laptops using power management and network awareness Run great on laptops using power management and network awareness APIs; use advanced ink and gesture support for mobile user interfacesAPIs; use advanced ink and gesture support for mobile user interfaces
Make an impressio
n
Be rock solid
Get connecte
d
http://msdn.microsoft.com/windowsvista/top10
3
Microsoft ManagementMicrosoft ManagementAdministrative Control and Administrative Control and
ScriptingScriptingMonad Shell (msh.exe)Monad Shell (msh.exe)Task Scheduler 6.0Task Scheduler 6.0Windows Management Windows Management Infrastructure (WMI & WMIC)Infrastructure (WMI & WMIC)WS-Management and toolsWS-Management and toolsCommand Prompt (cmd.exe) Command Prompt (cmd.exe) Microsoft Management Console Microsoft Management Console 3.03.0
Health Monitoring and Health Monitoring and TroubleshootingTroubleshootingWindows Eventing 6.0Windows Eventing 6.0
Event Viewer 6.0Event Viewer 6.0
Performance Counters 2.0Performance Counters 2.0
Server Performance Advisor 2.0Server Performance Advisor 2.0
Microsoft Operations ManagerMicrosoft Operations Manager
Deployment and Deployment and Software DistributionSoftware DistributionWindows Server Update Windows Server Update ServicesServices
Installation Environment (Win Installation Environment (Win PE)PE)
Windows Deployment Services Windows Deployment Services (WDS)(WDS)
Systems Management ServerSystems Management Server
Configuration Management Configuration Management and Protectionand ProtectionGroup Policy InfrastructureGroup Policy Infrastructure
Group Policy Management Group Policy Management ConsoleConsole
Windows Resource ProtectionWindows Resource Protection(Files and Registry)(Files and Registry)
User Access ProtectionUser Access Protection
4
RoadmapRoadmap
ScenarioScenario TodayToday TomorrowTomorrow
GUI ShellGUI Shell MMCMMC MMC with snap-ins layered MMC with snap-ins layered on on MonadMonad
Command ShellCommand Shell CMDCMD CMDCMD
SHSH
CSHCSH
KSHKSH
MonadMonadCommand Command ScriptingScripting
CMD scriptingCMD scripting CMD scriptingCMD scripting
MonadMonadCOM ScriptingCOM Scripting WSH WSH
VBScriptVBScript
JscriptJscript
WSHWSH VBScriptVBScript
JscriptJscript
Jscript (.NET)Jscript (.NET)MonadMonad
5
Monad Command ShellMonad Command ShellMotivationMotivation
User experienceUser experiencePreferred interaction model is Command-line oriented Preferred interaction model is Command-line oriented scriptingscripting
ArchitecturalArchitecturalRefactor shell, commands, and utilities Refactor shell, commands, and utilities
Objectflow engineObjectflow engine
Integrate command line, COM, and .NET scriptingIntegrate command line, COM, and .NET scripting
InspirationsInspirationsUnix Shells and UtilitiesUnix Shells and Utilities
Compositional model is extremely powerfulCompositional model is extremely powerful
AS400 / VMSAS400 / VMSNaming and syntactic consistency aids in learningNaming and syntactic consistency aids in learning
TCL / WSHTCL / WSHEmbeddable & multi-language supportEmbeddable & multi-language support
BASH, PERL, C#BASH, PERL, C#Style, utility, and expressivenessStyle, utility, and expressiveness
6
ObjectFlow EngineObjectFlow Engine
Cmdlets emit objectsCmdlets emit objects
Synthetic type systemSynthetic type systemExtendable by third-parties and usersExtendable by third-parties and users
Provides common data access syntaxProvides common data access syntax
Engine manages pipeline objectsEngine manages pipeline objectsIt shreds and coerces objects for It shreds and coerces objects for parameter bindingparameter binding
It renders into textual views for It renders into textual views for interactive users or interoperabilityinteractive users or interoperability
Utilities are object manipulatorsUtilities are object manipulators
7
Monad Value PropositionMonad Value Proposition
Developers writeDevelopers write.NET interfaces to management objects.NET interfaces to management objects
Thin Cmdlets/Providers for a rich experienceThin Cmdlets/Providers for a rich experience
Monad exposesMonad exposesCmdlets => command line toolsCmdlets => command line tools
Provider data => navigable drivesProvider data => navigable drives
Monad providesMonad providesInteractive shellInteractive shell
Strong language supportingStrong language supportingCommand line, COM, and .NET scripting stylesCommand line, COM, and .NET scripting styles
Single parser/argument validatorSingle parser/argument validator
Utilities and formattingUtilities and formatting
8
Cmdlet DevelopmentCmdlet Development
Focus on the experience of admin tasksFocus on the experience of admin tasksSub-class CMDLET Sub-class CMDLET Use attributes to expose properties as Use attributes to expose properties as parametersparametersOverride one or more methodOverride one or more method
BeginProcessing(), ProcessRecord(), EndProcessing(), BeginProcessing(), ProcessRecord(), EndProcessing(), StopProcessing()StopProcessing()
Use helper functionsUse helper functionsWriteProgress(), WriteDebug(), WriteObject(), WriteProgress(), WriteDebug(), WriteObject(), WriteError(), WriteVerbose()WriteError(), WriteVerbose()ShouldContinue(), ShouldProcess() ShouldContinue(), ShouldProcess() ThrowTerminatingError()ThrowTerminatingError()
10
Provider DevelopmentProvider Development
Focus on experience of interacting Focus on experience of interacting with your data with your data Implement one or more abstract Implement one or more abstract classes and interfacesclasses and interfaces
Abstract classesAbstract classesContainerCmdletProvider, ContainerCmdletProvider, DriveCmdletProvider, ItemCmdletProvider, DriveCmdletProvider, ItemCmdletProvider, NavigationCmdletProviderNavigationCmdletProvider
InterfacesInterfacesIContentProvider, IPropertiesProvider, IContentProvider, IPropertiesProvider, IPermissionProvider, etcIPermissionProvider, etc
Use attributes to expose capabilitiesUse attributes to expose capabilitiesCmdletProvider, SupportsShouldProcessCmdletProvider, SupportsShouldProcess
11
JET Database ProviderJET Database Provider
James TruherJames TruherProgram ManagerProgram ManagerAxPAxP
12
A Command Scripting A Command Scripting LanguageLanguage
Scripting languages do not lend Scripting languages do not lend themselves to an interactive shellthemselves to an interactive shell
Opportunity to improve learn-ability Opportunity to improve learn-ability through better consistencythrough better consistency
Provide production ready scriptingProvide production ready scripting
$a = get-process $a = get-process # vs Declaration# vs Declaration$a > filename $a > filename # Easy file interaction# Easy file interactioncopy-item a b copy-item a b # No Quoting arguments# No Quoting arguments
While ( ) { } # vs while … do … doneWhile ( ) { } # vs while … do … doneIf ( ) { } # vs if … then … fiIf ( ) { } # vs if … then … fiSwitch ( ) { } # case … ;; esacSwitch ( ) { } # case … ;; esac
13
Tools For DiscoveryTools For Discovery
Get-HelpGet-HelpRetrieves documentation about Retrieves documentation about Cmdlets and language topicsCmdlets and language topics
Get-CommandGet-CommandRetrieves information about Cmdlets, Retrieves information about Cmdlets, scripts, aliases, functions, filters and scripts, aliases, functions, filters and native executablesnative executables
Get-MemberGet-MemberRetrieves information about Retrieves information about ObjectsObjects
14
Uniform Data Access Uniform Data Access SyntaxSyntax
XMLXML
WMI/ADSIWMI/ADSI> $x.Handles (msh) vs. x.Properties[“Handles”] (vbs) > $x.Handles (msh) vs. x.Properties[“Handles”] (vbs)
ADOADOColumn names mapped to propertiesColumn names mapped to properties
Synthetic types created when possibleSynthetic types created when possibleSystem.__ComObject#{d30c1661-cdaf-11d0-8a3e-System.__ComObject#{d30c1661-cdaf-11d0-8a3e-00c04fc9e26e}00c04fc9e26e}System.Xml.XmlElement#http://System.Xml.XmlElement#http://schemas.microsoft.org/root/HW_MNGT/schemas.microsoft.org/root/HW_MNGT/2004/07#NumericSensor2004/07#NumericSensorSystem.Management.ManagementObject#root\cimv2\System.Management.ManagementObject#root\cimv2\Win32_Win32_ProcessProcess
$x=[xml]"<a><b><c>TEST</c></b></a>"$x=[xml]"<a><b><c>TEST</c></b></a>"$x.a.b.c$x.a.b.c$x | format-custom$x | format-custom
15
Scripting TextScripting Text
.NET String class is the foundation .NET String class is the foundation classclass
Many .NET classes can be created Many .NET classes can be created with stringswith strings
Native support for useful datatypesNative support for useful datatypesArrays, HashTable, Regex, XMLArrays, HashTable, Regex, XML
Rich string operatorsRich string operatorsMatch, Like, Replace, Multiply, AddMatch, Like, Replace, Multiply, Add
[datetime]"1/1/2006"[datetime]"1/1/2006"[xml]"<a><b>test</b></a>“[xml]"<a><b>test</b></a>“[system.io.fileinfo]"C:\windows\notepad.exe"[system.io.fileinfo]"C:\windows\notepad.exe"
16
Scripting COM Scripting COM
New-Object –ComObject <progid>New-Object –ComObject <progid>Binds to automation-compatible COM objectsBinds to automation-compatible COM objects
Reflect for properties/methodsReflect for properties/methods
Access properties/methodsAccess properties/methods
Use in pipelines and utilitiesUse in pipelines and utilities
17
Scripting .NETScripting .NET
Create .NET objectsCreate .NET objects$d=New-Object System.DateTime 2005,4,20$d=New-Object System.DateTime 2005,4,20
Inspecting/Accessing properties-methodsInspecting/Accessing properties-methods$d.DayOfWeek $d.DayOfWeek $d.AddMonths(6)$d.AddMonths(6)[DateTime]::Now[DateTime]::Now[DateTime]::IsLeapYear(2005)[DateTime]::IsLeapYear(2005)Method matching is done via least-type Method matching is done via least-type differencingdifferencing
Use casts to override [DateTime]::IsLeapYear([INT]$x)Use casts to override [DateTime]::IsLeapYear([INT]$x)
19
Call To Action!Call To Action!
Write .NET interfaces to your Write .NET interfaces to your management objectsmanagement objects
Expose tasks by creating classes Expose tasks by creating classes which derive from Cmdletwhich derive from Cmdlet
Expose (hierarchical) data by Expose (hierarchical) data by implementing a Provider implementing a Provider
Write and share scriptsWrite and share scripts
20
Community ResourcesCommunity Resources
At PDCAt PDCFor more information, go seeFor more information, go see
FUN311 Manageable Apps, FUN301 MMC 3.0, FUN315 Perf FUN311 Manageable Apps, FUN301 MMC 3.0, FUN315 Perf counters, FUN316 Schematized Events, counters, FUN316 Schematized Events, Hands-on-Labs: Hands-on-Labs: TLNHOL06 (cmdlet), TLNHOL08 (provider), TLNHOL25 (scripting)TLNHOL06 (cmdlet), TLNHOL08 (provider), TLNHOL25 (scripting)Ask The Experts tableAsk The Experts tableTools and Languages Track loungeTools and Languages Track lounge
After PDCAfter PDCScriptCenter: ScriptCenter: http://www.microsoft.com/technet/scriptcenter/default.mspxhttp://www.microsoft.com/technet/scriptcenter/default.mspxNewsgroup: Microsoft.Public.Windows.Server.ScriptingNewsgroup: Microsoft.Public.Windows.Server.ScriptingChannel 9 tag: Channel 9 tag: http://channel9.msdn.com/tags/Monadhttp://channel9.msdn.com/tags/MonadTeam blog: Team blog: http://blogs.msdn.com/monad/default.aspxhttp://blogs.msdn.com/monad/default.aspxWiki:Wiki: http://channel9.msdn.com/wiki/default.aspx/Channel9.MSHWikihttp://channel9.msdn.com/wiki/default.aspx/Channel9.MSHWiki2 Monad “Best of TechEd” Webcasts 2 Monad “Best of TechEd” Webcasts http://www.microsoft.com/events/series/teched2005.mspxhttp://www.microsoft.com/events/series/teched2005.mspx