{"id":12445,"date":"2012-04-19T19:42:02","date_gmt":"2012-04-19T18:42:02","guid":{"rendered":"https:\/\/aidanfinn.com\/?p=12445"},"modified":"2012-04-19T19:42:02","modified_gmt":"2012-04-19T18:42:02","slug":"mms2012-sc-2012-vmm-powershell-is-your-friend-and-heres-why","status":"publish","type":"post","link":"https:\/\/aidanfinn.com\/?p=12445","title":{"rendered":"MMS2012 &#8211; SC 2012 VMM: PowerShell Is Your Friend, And Here\u2019s Why"},"content":{"rendered":"<p>Speakers: Hector Linares, Senior Program Manager and Susan Hill, Senior Technical Writer, MSFT<\/p>\n<p>Went from 162 cmdlets in VMM 2008 R2 to 438 in VMM 2012.&#160; They maintained backwards compatibility through aliases.&#160; The cmdlets got renamed so they don\u2019t conflict with the new Windows Server 2012 Hyper-V cmdlets.<\/p>\n<p>POSH is the driving force for the UI.&#160; Cmdlets are executed as jobs in VMM so there\u2019s an audit trail.&#160; Other partners, e.g. TFS or XenDesktop, integrates with VMM cmdlets for deployment.<\/p>\n<p><strong><u>Overview of VMM 2012 system<\/u><\/strong><\/p>\n<ul>\n<li><strong><u>I<\/u><\/strong>nfrastructure: HA VMM Server, PowerShell, Upgrade, Custom Properties<\/li>\n<li>Fabric: Server lifecycle management, multiple hypervisors, network management, storage management, dynamic optimisation.<\/li>\n<li>Clouds: An abstraction of fabrics.&#160; Application ower usage, capacity and capability, delegation and quota.<\/li>\n<li>Services: Service templates, application deployment, customer command execution, image-based servicing.<\/li>\n<\/ul>\n<p><strong><u>Cmdlet groups: 46 nouns<\/u><\/strong><\/p>\n<ul>\n<li><em>get-command \u2013module VirtualMachinemanager \u2013commandtype cmdlet<\/em><\/li>\n<li><em>get-scvirtualmachine<\/em> <\/li>\n<li>Now you run read-SCvirtualmachine to do a refresh<\/li>\n<li>Repair-scvirtualmachine wil do the repair action.<\/li>\n<li>Stop-scvirtualmachine takes more parameters, e.g. stop (cold), save state, or clean shutdown<\/li>\n<li>Register-sCVMHost to register a bare metal host.<\/li>\n<li>Restart-SCVMHost to reboot a host.<\/li>\n<li>Test-SCVMHostCluster to run a cluster validation.<\/li>\n<\/ul>\n<p><strong><u>Domain Join for VM<\/u><\/strong><\/p>\n<p>You can use \u2013DomainJoinOrganizationalUnit \u201cou=, dc=\u201d to set where a new VM joins in a domain.<\/p>\n<p>-AutolongCredential to&#160; set autologon account and \u2013AutoLogonCount to say how many times that will run.<\/p>\n<p>These must be set at the same time.&#160; You can clean up with disableautologon.<\/p>\n<p><strong><u>UnattendSettings<\/u><\/strong><\/p>\n<p>Looks like we can use this to customise an unattend.xml for Specialize (3) and OOBE (6) passes.&#160; Use Add)key,value) to add settings.<\/p>\n<ul>\n<li>$unattend.add<\/li>\n<li>$unattend.remove<\/li>\n<\/ul>\n<p>Your settings will override settings in GuestOSProfile or VMTemplate.&#160; You have to commit the settings with set-scvmtemplate (I think \u2013 quick slides) to use them.<\/p>\n<p><strong><u>Demo<\/u><\/strong><\/p>\n<p><strong>I<\/strong>n the demo, he wants to override a template.&#160; He gets the template.&#160; Now he creates a new temporary template.&#160; He sets the OU for it to join to.&#160; He creates runas account as the account he\u2019ll use for building the VM.&#160; He uses that for autologon.&#160; He get\u2019s the unattend object.&#160; No he adds a bunch of overrides to the template using $unattend.add().&#160; set-scvmtemplate \u2013 vmtemplate $template \u2013UnanntedSettings $unattend) | Out-Null commits the overrides.&#160; They create a $vmconfig using new-scmconfiguration \u2013vmtemplate $template \u2013Name ($vmNamePrefix + @_config@)) | fl Name.&#160; <\/p>\n<p>VMM still doesn\u2019t have the ability to create differencing disks so you have to use WMI to do it instead.&#160; Apparently this has been blogged.&#160; <\/p>\n<p>He sets the disk name and location.&#160; This can be done on a per disk basis.&#160; In this cmdlet he\u2019s told it to use an existing VHD he just created using WMI.&#160; <\/p>\n<p><strong><u>Virtual Machine Configuration<\/u><\/strong><\/p>\n<p>You can create a VM config so you can deploy very specific VM configs, different from the defaults.&#160; $VHD to get-scvirtualharddisk from the library.&#160; Then set$storageclass viariable with get-scstorageclassification.&#160; Now $ComputeTier with get-sccomputertier.&#160; Then $VMconfig with new-scvmconfiguration and the $computertier variable.&#160; $vhdconfig and get-scvirtualharddiskconfiguration and $vmconfig.&#160; setscvirtualharddiskconfiguration and $vhdconfig and $vhd and $storageclass.&#160; <\/p>\n<p>Now $virtualnetworkadatperconfig = get-scvirtualnetworkadapterconfiguration.&#160; Setscvirtunetworkadapterconfiguration with $virtualnetadapterconfiguration.&#160; And then more stuff.&#160; Download the slide deck when it comes out in a few days.<\/p>\n<p>Basically you build up a VM config and then you create a VM from that config.<\/p>\n<p>There is a script on the net that will automatically sign the scripts in your VMM library.&#160; It was written for 2008 R2.<\/p>\n<p>We\u2019re shown a demo where a script checks for expired (by date) VMs and stores them in the VMM library.<\/p>\n<p><strong><u>Hyper-V Data Exchange<\/u><\/strong><\/p>\n<p>Can read and set the KVPs in the VM.&#160; Can read data from a VM without using the network via read.&#160; Can pass in string values to a VM regardless of power state with Set.&#160; A Key is a registry VALUE create to store DATA.&#160; The value is the DATA.&#160; And a KVPMAP is a hash table is one ore more VALUEs or DATA.<\/p>\n<p>Cool demo where Hector writes to the registry of the VM in different power states (on, off, paused, save state).<\/p>\n<p><strong><u>VDI<\/u><\/strong><\/p>\n<p>Jobs submitted to VMM using \u2013RunAsynchronously from one or more runspaces.&#160; Hundreds of parallel jobs.&#160; Typically used in the morning bootstorm in VDI.<\/p>\n<p>VMM 2012 has a concept of threadpools.&#160; By default it handles 25 threads per core in the VMM server with a max of 150 (requires a monster VMM server).&#160; High number of context switches can slow performance of the VMM server.&#160; The WCF timeout is configurable (default of 120 seconds).&#160; Monitor the performance of jobs if you increase threadpools.<\/p>\n<p>If you run asynchronously then query the job object for status.&#160; For higher throughput, use multiple threads with multiple runspaces.<\/p>\n<p>Make sure you tune the VMM refreshers in VDI, and also in very large static environments.&#160; 4000 VMs doing a light refresh every 2 minutes and a ful refresh every 30 minutes will hammer the VMM server.&#160; <\/p>\n<p>&#160;<\/p>\n<p><div style=\"padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px\" id=\"scid:0767317B-992E-4b12-91E0-4F059A8CECA8:5d1099f3-1da8-42ba-ad0a-f3e2e4278005\" class=\"wlWriterEditableSmartContent\">Technorati Tags: <a href=\"http:\/\/technorati.com\/tags\/Event+Notes\" rel=\"tag\">Event Notes<\/a>,<a href=\"http:\/\/technorati.com\/tags\/Events\" rel=\"tag\">Events<\/a>,<a href=\"http:\/\/technorati.com\/tags\/VMM\" rel=\"tag\">VMM<\/a>,<a href=\"http:\/\/technorati.com\/tags\/Private+Cloud\" rel=\"tag\">Private Cloud<\/a><\/div><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Speakers: Hector Linares, Senior Program Manager and Susan Hill, Senior Technical Writer, MSFT Went from 162 cmdlets in VMM 2008 R2 to 438 in VMM 2012.&#160; They maintained backwards compatibility through aliases.&#160; The cmdlets got renamed so they don\u2019t conflict with the new Windows Server 2012 Hyper-V cmdlets. POSH is the driving force for the &hellip; <a href=\"https:\/\/aidanfinn.com\/?p=12445\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;MMS2012 &#8211; SC 2012 VMM: PowerShell Is Your Friend, And Here\u2019s Why&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_uf_show_specific_survey":0,"_uf_disable_surveys":false,"footnotes":""},"categories":[14],"tags":[176,177,88,196],"class_list":["post-12445","post","type-post","status-publish","format-standard","hentry","category-eventnotes","tag-eventnotes","tag-events","tag-private-cloud","tag-vmm"],"aioseo_notices":[],"jetpack_featured_media_url":"","amp_enabled":true,"_links":{"self":[{"href":"https:\/\/aidanfinn.com\/index.php?rest_route=\/wp\/v2\/posts\/12445","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/aidanfinn.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/aidanfinn.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/aidanfinn.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/aidanfinn.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=12445"}],"version-history":[{"count":0,"href":"https:\/\/aidanfinn.com\/index.php?rest_route=\/wp\/v2\/posts\/12445\/revisions"}],"wp:attachment":[{"href":"https:\/\/aidanfinn.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=12445"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/aidanfinn.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=12445"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/aidanfinn.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=12445"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}