Small fix to permissions in disk.ps1

Sep 21, 2011 at 1:04 AM

Great module!

I got errors running Get-VhdDefaultPath even as an admin when running under reduced permissions (from a non-admin prompt, for instance) until I added the -EnableAllPrivileges parameter to the Get-WmiObject call.

Function Get-VhdDefaultPath
{# .ExternalHelp  MAML-VMDisk.XML
    param ([ValidateNotNullOrEmpty()]
           [String]$Server=".")    #Only work with images on one server 
    (Get-WmiObject -EnableAllPrivileges -computerName $server -NameSpace $HyperVNamespace -Class "MsVM_VirtualSystemManagementServiceSettingData").DefaultVirtualHardDiskPath -replace "\\$",""

Sep 21, 2011 at 1:10 AM

Apparently that was not the problem.  I am broken again from a non-elevated context.


Sep 21, 2011 at 1:24 AM

Somehow I had a bad module load state in my script context and correct application of Import-Module -Force cleared it up.

Sorry for the false alarm!