Difference between revisions of "Hyper-V"

From Hornbill
Jump to navigation Jump to search
Line 36: Line 36:
 
[[File:hyperv_job.png|300px|right|link=https://wiki.hornbill.com/images/b/b8/Diskcleanup_job.png]]
 
[[File:hyperv_job.png|300px|right|link=https://wiki.hornbill.com/images/b/b8/Diskcleanup_job.png]]
  
The Hyper-V package contains the following operations, than can be used to create ITOM Jobs directly, or included in your [[Business_Process_Designer|Business Processes]] and/or IT Operations Management Rubooks.
+
The Hyper-V package contains the following operations, than can be used to create ITOM Jobs directly, or included in your [[Business_Process_Designer|Business Processes]] and/or IT Operations Management Rubooks.
  
 +
<div class="mw-collapsible mw-collapsed" data-collapsetext="Show Less" data-expandtext="Read More" style="width:1050px">
 
===Start VM===
 
===Start VM===
 
+
<div class="mw-collapsible-content">
 
This operation will Start a Hyper-V Virtual Machine.
 
This operation will Start a Hyper-V Virtual Machine.
  
Line 56: Line 57:
 
* <code>outcome</code> - Outcome of the operation. Can be OK or FAIL;
 
* <code>outcome</code> - Outcome of the operation. Can be OK or FAIL;
 
* <code>warnings</code> - Any warnings returned by the operation.
 
* <code>warnings</code> - Any warnings returned by the operation.
 
+
</div></div>
 +
<div class="mw-collapsible mw-collapsed" data-collapsetext="Show Less" data-expandtext="Read More" style="width:1050px">
 
===Stop VM===
 
===Stop VM===
 
+
<div class="mw-collapsible-content">
 
This operation will Stop a Hyper-V Virtual Machine.
 
This operation will Stop a Hyper-V Virtual Machine.
  
Line 78: Line 80:
 
* <code>outcome</code> - Outcome of the operation. Can be OK or FAIL
 
* <code>outcome</code> - Outcome of the operation. Can be OK or FAIL
 
* <code>warnings</code> - Any warnings returned by the operation
 
* <code>warnings</code> - Any warnings returned by the operation
 
+
</div></div>
 +
<div class="mw-collapsible mw-collapsed" data-collapsetext="Show Less" data-expandtext="Read More" style="width:1050px">
 
===Suspend VM===
 
===Suspend VM===
 
+
<div class="mw-collapsible-content">
 
This operation will Suspend a Hyper-V Virtual Machine.
 
This operation will Suspend a Hyper-V Virtual Machine.
  
Line 97: Line 100:
 
* <code>outcome</code> - Outcome of the operation. Can be OK or FAIL;
 
* <code>outcome</code> - Outcome of the operation. Can be OK or FAIL;
 
* <code>warnings</code> - Any warnings returned by the operation.
 
* <code>warnings</code> - Any warnings returned by the operation.
 
+
</div></div>
 +
<div class="mw-collapsible mw-collapsed" data-collapsetext="Show Less" data-expandtext="Read More" style="width:1050px">
 
===Resume VM===  
 
===Resume VM===  
 
+
<div class="mw-collapsible-content">
 
This operation will Resume a Hyper-V Virtual Machine.
 
This operation will Resume a Hyper-V Virtual Machine.
  
Line 116: Line 120:
 
* <code>outcome</code> - Outcome of the operation. Can be OK or FAIL;
 
* <code>outcome</code> - Outcome of the operation. Can be OK or FAIL;
 
* <code>warnings</code> - Any warnings returned by the operation.
 
* <code>warnings</code> - Any warnings returned by the operation.
 
+
</div></div>
 +
<div class="mw-collapsible mw-collapsed" data-collapsetext="Show Less" data-expandtext="Read More" style="width:1050px">
 
===Restart VM===
 
===Restart VM===
 
+
<div class="mw-collapsible-content">
 
This operation will Restart a Hyper-V Virtual Machine.
 
This operation will Restart a Hyper-V Virtual Machine.
  
Line 135: Line 140:
 
* <code>outcome</code> - Outcome of the operation. Can be OK or FAIL;
 
* <code>outcome</code> - Outcome of the operation. Can be OK or FAIL;
 
* <code>warnings</code> - Any warnings returned by the operation.
 
* <code>warnings</code> - Any warnings returned by the operation.
 
+
</div></div>
 +
<div class="mw-collapsible mw-collapsed" data-collapsetext="Show Less" data-expandtext="Read More" style="width:1050px">
 
===Save VM===
 
===Save VM===
 
+
<div class="mw-collapsible-content">
 
This operation will Save a Hyper-V Virtual Machine.
 
This operation will Save a Hyper-V Virtual Machine.
  
Line 154: Line 160:
 
* <code>outcome</code> - Outcome of the operation. Can be OK or FAIL;
 
* <code>outcome</code> - Outcome of the operation. Can be OK or FAIL;
 
* <code>warnings</code> - Any warnings returned by the operation.
 
* <code>warnings</code> - Any warnings returned by the operation.
 
+
</div></div>
 +
<div class="mw-collapsible mw-collapsed" data-collapsetext="Show Less" data-expandtext="Read More" style="width:1050px">
 
===Checkpoint VM===
 
===Checkpoint VM===
 
+
<div class="mw-collapsible-content">
 
This operation will create a Checkpoint for a Hyper-V Virtual Machine.
 
This operation will create a Checkpoint for a Hyper-V Virtual Machine.
  
Line 174: Line 181:
 
* <code>outcome</code> - Outcome of the operation. Can be OK or FAIL;
 
* <code>outcome</code> - Outcome of the operation. Can be OK or FAIL;
 
* <code>warnings</code> - Any warnings returned by the operation.
 
* <code>warnings</code> - Any warnings returned by the operation.
 
+
</div></div>
 +
<div class="mw-collapsible mw-collapsed" data-collapsetext="Show Less" data-expandtext="Read More" style="width:1050px">
 
===Remove VM Snapshot===
 
===Remove VM Snapshot===
 
+
<div class="mw-collapsible-content">
 
This operation will remove a snapshot from a Hyper-V Virtual Machine.
 
This operation will remove a snapshot from a Hyper-V Virtual Machine.
  
Line 195: Line 203:
 
* <code>outcome</code> - Outcome of the operation. Can be OK or FAIL;
 
* <code>outcome</code> - Outcome of the operation. Can be OK or FAIL;
 
* <code>warnings</code> - Any warnings returned by the operation.
 
* <code>warnings</code> - Any warnings returned by the operation.
 
+
</div></div>
 +
<div class="mw-collapsible mw-collapsed" data-collapsetext="Show Less" data-expandtext="Read More" style="width:1050px">
 
===Enable VM Resource Metering===
 
===Enable VM Resource Metering===
 
+
<div class="mw-collapsible-content">
 
This operation will enable Resource Metering on a Hyper-V Virtual Machine.
 
This operation will enable Resource Metering on a Hyper-V Virtual Machine.
  
Line 214: Line 223:
 
* <code>outcome</code> - Outcome of the operation. Can be OK or FAIL;
 
* <code>outcome</code> - Outcome of the operation. Can be OK or FAIL;
 
* <code>warnings</code> - Any warnings returned by the operation.
 
* <code>warnings</code> - Any warnings returned by the operation.
 
+
</div></div>
 +
<div class="mw-collapsible mw-collapsed" data-collapsetext="Show Less" data-expandtext="Read More" style="width:1050px">
 
===Measure VM===
 
===Measure VM===
 
+
<div class="mw-collapsible-content">
 
This operation will  gather resource utilization data for a specific Hyper-V Virtual Machine, where the VM has Resource Metering enabled.
 
This operation will  gather resource utilization data for a specific Hyper-V Virtual Machine, where the VM has Resource Metering enabled.
  
Line 240: Line 250:
 
* <code>networkInbound</code> - Network inbound usage;
 
* <code>networkInbound</code> - Network inbound usage;
 
* <code>networkOutbound</code> - Network outbound usage.
 
* <code>networkOutbound</code> - Network outbound usage.
 
+
</div></div>
 +
<div class="mw-collapsible mw-collapsed" data-collapsetext="Show Less" data-expandtext="Read More" style="width:1050px">
 
===Set Memory===
 
===Set Memory===
 
+
<div class="mw-collapsible-content">
 
This operation will set the memory details for a specific Hyper-V Virtual Machine. The target VM must be in a shutdown state, as per the [https://docs.microsoft.com/en-us/powershell/module/hyper-v/set-vmmemory?view=win10-ps Set-VMMemory documentation].
 
This operation will set the memory details for a specific Hyper-V Virtual Machine. The target VM must be in a shutdown state, as per the [https://docs.microsoft.com/en-us/powershell/module/hyper-v/set-vmmemory?view=win10-ps Set-VMMemory documentation].
  
Line 263: Line 274:
 
* <code>outcome</code> - Outcome of the operation. Can be OK or FAIL;
 
* <code>outcome</code> - Outcome of the operation. Can be OK or FAIL;
 
* <code>warnings</code> - Any warnings returned by the operation.
 
* <code>warnings</code> - Any warnings returned by the operation.
 
+
</div></div>
 +
<div class="mw-collapsible mw-collapsed" data-collapsetext="Show Less" data-expandtext="Read More" style="width:1050px">
 
===Set Processor===
 
===Set Processor===
 
+
<div class="mw-collapsible-content">
 
This operation will set the processor details for a specific Hyper-V Virtual Machine. The target VM must be in a shutdown state, as per the [https://docs.microsoft.com/en-us/powershell/module/hyper-v/set-vmprocessor?view=win10-ps Set-VMProcessor documentation].
 
This operation will set the processor details for a specific Hyper-V Virtual Machine. The target VM must be in a shutdown state, as per the [https://docs.microsoft.com/en-us/powershell/module/hyper-v/set-vmprocessor?view=win10-ps Set-VMProcessor documentation].
  
Line 290: Line 302:
 
* <code>outcome</code> - Outcome of the operation. Can be OK or FAIL;
 
* <code>outcome</code> - Outcome of the operation. Can be OK or FAIL;
 
* <code>warnings</code> - Any warnings returned by the operation.
 
* <code>warnings</code> - Any warnings returned by the operation.
 
+
</div></div>
 +
<div class="mw-collapsible mw-collapsed" data-collapsetext="Show Less" data-expandtext="Read More" style="width:1050px">
 
===New VHD===
 
===New VHD===
 
+
<div class="mw-collapsible-content">
 
This operation will create a new Virtual Hard Disk, then mount, initialize, partition and format it so the drive is ready to use, before adding it to the target VM. See the [https://docs.microsoft.com/en-us/powershell/module/hyper-v/new-vhd?view=win10-ps New-VHD documentation] for more information.
 
This operation will create a new Virtual Hard Disk, then mount, initialize, partition and format it so the drive is ready to use, before adding it to the target VM. See the [https://docs.microsoft.com/en-us/powershell/module/hyper-v/new-vhd?view=win10-ps New-VHD documentation] for more information.
  
Line 339: Line 352:
 
* <code>ID</code> - The ID of the new VHD once attached to the VM;
 
* <code>ID</code> - The ID of the new VHD once attached to the VM;
 
* <code>Name</code> - The name of the new VHD;
 
* <code>Name</code> - The name of the new VHD;
 
+
</div></div>
 +
<div class="mw-collapsible mw-collapsed" data-collapsetext="Show Less" data-expandtext="Read More" style="width:1050px">
 
===Get VHD===
 
===Get VHD===
 
+
<div class="mw-collapsible-content">
 
This operation will retrieve details about a Virtual Hard Disk, using either its Path or Disk Number. See the [https://docs.microsoft.com/en-us/powershell/module/hyper-v/get-vhd?view=win10-ps Get-VHD documentation] for more information.
 
This operation will retrieve details about a Virtual Hard Disk, using either its Path or Disk Number. See the [https://docs.microsoft.com/en-us/powershell/module/hyper-v/get-vhd?view=win10-ps Get-VHD documentation] for more information.
  
Line 374: Line 388:
 
* <code>AddressAbstractionType</code> - The address abstraction type;
 
* <code>AddressAbstractionType</code> - The address abstraction type;
 
* <code>Number</code> - The VDH number.
 
* <code>Number</code> - The VDH number.
 
+
</div></div>
 
[[Category:ITOM]]
 
[[Category:ITOM]]

Revision as of 10:57, 8 April 2020

Home > Administration > IT Operations Management > ITOM Package Library > Hyper-V Index

microsoft_logo.png

Introduction

The Hyper-V package for Hornbill's IT Operations Management (ITOM) contains operations to automate the management of Hyper-V environments.

Related Articles

Target Environment Requirements

Script Execution Machine Requirements

  • The HyperV PowerShell module needs to installed on the machine that will be executing the scripts (the correct Hyper-V Management Package for your OS);
  • If the script execution policy on the machine executing these operations is set to Restricted, then this will need to be updated to something less restrictive. See the PowerShell Documentation for more information.

KeySafe Configuration

Itomtarget keysafe.png

When creating SIS jobs for operations contained within this package, they need to be run on the target machine as a user who has the correct privileges on the target.

To configure your Target Machine account authentication in KeySafe:

  • In the Admin console, navigate to: System > Security > KeySafe;
  • Click on + then select Username + Password;
  • Give the KeySafe Key a Title (this is the name/identifier for the target machine account as you will see it when creating an IT Automation Job, or adding an IT Automation node to a Business Process or Runbook);
  • Optionally add a description;
  • Populate the Username field with the domain/local account username for the account being used on the target machine;
  • Populate the Password field with the password for the above account;
  • Select Create Key to save.

Once you have created your KeySafe Key, you can then use it when creating IT Automation Jobs from this package. See screenshots to the right for examples.

Package Operations

Hyperv job.png

The Hyper-V package contains the following operations, than can be used to create ITOM Jobs directly, or included in your Business Processes and/or IT Operations Management Rubooks.

Start VM

This operation will Start a Hyper-V Virtual Machine.

Extra Credentials

None required.

Input Parameters

  • VMName (MANDATORY) - The name of the Virtual Machine to perform the action against. Supports the * wildcard to perform the action against multiple VMs;
  • HostName - Optionally provide the Hyper-V host to perform the action on. NetBIOS names, IP addresses, and fully qualified domain names are allowable.

Output Parameters

  • errors - Any errors returned by the operation;
  • outcome - Outcome of the operation. Can be OK or FAIL;
  • warnings - Any warnings returned by the operation.

Stop VM

This operation will Stop a Hyper-V Virtual Machine.

Extra Credentials

None required.

Input Parameters

  • VMName (MANDATORY) - The name of the Virtual Machine to perform the action against. Supports the * wildcard to perform the action against multiple VMs;
  • HostName - Optionally provide the Hyper-V host to perform the action on. NetBIOS names, IP addresses, and fully qualified domain names are allowable;
  • Force - Specifies that the shutdown of the virtual machine is to be forced. If the virtual machine has applications with unsaved data, the virtual machine has five minutes to save data and shut down. If the virtual machine is locked, it is shut down immediately;
  • Save - Specifies that the virtual machine is to be saved;
  • TurnOff - Specifies that the virtual machine is to be turned off.

Output Parameters

  • errors - Any errors returned by the operation
  • outcome - Outcome of the operation. Can be OK or FAIL
  • warnings - Any warnings returned by the operation

Suspend VM

This operation will Suspend a Hyper-V Virtual Machine.

Extra Credentials

None required.

Input Parameters

  • VMName (MANDATORY) - The name of the Virtual Machine to perform the action against. Supports the * wildcard to perform the action against multiple VMs;
  • HostName - Optionally provide the Hyper-V host to perform the action on. NetBIOS names, IP addresses, and fully qualified domain names are allowable.

Output Parameters

  • errors - Any errors returned by the operation;
  • outcome - Outcome of the operation. Can be OK or FAIL;
  • warnings - Any warnings returned by the operation.

Resume VM

This operation will Resume a Hyper-V Virtual Machine.

Extra Credentials

None required.

Input Parameters

  • VMName (MANDATORY) - The name of the Virtual Machine to perform the action against. Supports the * wildcard to perform the action against multiple VMs;
  • HostName - Optionally provide the Hyper-V host to perform the action on. NetBIOS names, IP addresses, and fully qualified domain names are allowable.

Output Parameters

  • errors - Any errors returned by the operation;
  • outcome - Outcome of the operation. Can be OK or FAIL;
  • warnings - Any warnings returned by the operation.

Restart VM

This operation will Restart a Hyper-V Virtual Machine.

Extra Credentials

None required.

Input Parameters

  • VMName (MANDATORY) - The name of the Virtual Machine to perform the action against. Supports the * wildcard to perform the action against multiple VMs;
  • HostName - Optionally provide the Hyper-V host to perform the action on. NetBIOS names, IP addresses, and fully qualified domain names are allowable.

Output Parameters

  • errors - Any errors returned by the operation;
  • outcome - Outcome of the operation. Can be OK or FAIL;
  • warnings - Any warnings returned by the operation.

Save VM

This operation will Save a Hyper-V Virtual Machine.

Extra Credentials

None required.

Input Parameters

  • VMName (MANDATORY) - The name of the Virtual Machine to perform the action against. Supports the * wildcard to perform the action against multiple VMs;
  • HostName - Optionally provide the Hyper-V host to perform the action on. NetBIOS names, IP addresses, and fully qualified domain names are allowable.

Output Parameters

  • errors - Any errors returned by the operation;
  • outcome - Outcome of the operation. Can be OK or FAIL;
  • warnings - Any warnings returned by the operation.

Checkpoint VM

This operation will create a Checkpoint for a Hyper-V Virtual Machine.

Extra Credentials

None required.

Input Parameters

  • VMName (MANDATORY) - The name of the Virtual Machine to perform the action against. Supports the * wildcard to perform the action against multiple VMs;
  • HostName - Optionally provide the Hyper-V host to perform the action on. NetBIOS names, IP addresses, and fully qualified domain names are allowable;
  • SnapshotName - Optionally provide the name of the new Snapshot.

Output Parameters

  • errors - Any errors returned by the operation;
  • outcome - Outcome of the operation. Can be OK or FAIL;
  • warnings - Any warnings returned by the operation.

Remove VM Snapshot

This operation will remove a snapshot from a Hyper-V Virtual Machine.

Extra Credentials

None required.

Input Parameters

  • VMName (MANDATORY) - The name of the Virtual Machine to perform the action against. Supports the * wildcard to perform the action against multiple VMs;
  • HostName - Optionally provide the Hyper-V host to perform the action on. NetBIOS names, IP addresses, and fully qualified domain names are allowable;
  • SnapshotName (MANDATORY) - Provide the name of the new Snapshot;
  • IncludeAllChildSnapshots - Optionally define whether all child snapshots should be deleted.

Output Parameters

  • errors - Any errors returned by the operation;
  • outcome - Outcome of the operation. Can be OK or FAIL;
  • warnings - Any warnings returned by the operation.

Enable VM Resource Metering

This operation will enable Resource Metering on a Hyper-V Virtual Machine.

Extra Credentials

None required.

Input Parameters

  • VMName (MANDATORY) - The name of the Virtual Machine to perform the action against. Supports the * wildcard to perform the action against multiple VMs;
  • HostName - Optionally provide the Hyper-V host to perform the action on. NetBIOS names, IP addresses, and fully qualified domain names are allowable.

Output Parameters

  • errors - Any errors returned by the operation;
  • outcome - Outcome of the operation. Can be OK or FAIL;
  • warnings - Any warnings returned by the operation.

Measure VM

This operation will gather resource utilization data for a specific Hyper-V Virtual Machine, where the VM has Resource Metering enabled.

Extra Credentials

None required.

Input Parameters

  • VMName (MANDATORY) - The name of the Virtual Machine to perform the action against. Supports the * wildcard to perform the action against multiple VMs;
  • HostName - Optionally provide the Hyper-V host to perform the action on. NetBIOS names, IP addresses, and fully qualified domain names are allowable.

Output Parameters

  • errors - Any errors returned by the operation;
  • outcome - Outcome of the operation. Can be OK or FAIL;
  • warnings - Any warnings returned by the operation;
  • avgCPU - Average CPU usage;
  • avgRAM - Average RAM usage;
  • maxRAM - Maximum RAM usage;
  • minRam - Minimum RAM usage;
  • totalDisk - Total disk usage;
  • networkInbound - Network inbound usage;
  • networkOutbound - Network outbound usage.

Set Memory

This operation will set the memory details for a specific Hyper-V Virtual Machine. The target VM must be in a shutdown state, as per the Set-VMMemory documentation.

Input Parameters

  • VMName</code - The name of the Virtual Machine to perform the action against;
  • HostName - Optionally provide the Hyper-V host to perform the action on. NetBIOS names, IP addresses, and fully qualified domain names are allowable;
  • DynamicMemoryEnabled - Specifies whether dynamic memory is to be enabled on the virtual machine to be configured;
  • MinimumBytes - Specifies the minimum amount of memory to be used by a virtual machine which has dynamic memory enabled. Supports values such as 512MB, 1GB etc;
  • StartupBytes - Specifies the initial amount of memory to be assigned to a virtual machine with dynamic memory enabled, or the total amount of memory to be assigned to a virtual machine with dynamic memory disabled;
  • MaximumBytes - Specifies the maximum amount of memory to be used by a virtual machine which has dynamic memory enabled. Supports values such as 512MB, 1GB etc;
  • Priority - Sets the priority for memory availability to this virtual machine relative to other virtual machines on the virtual machine host. Allowed values range from 0 to 100. Set to -1 to disable this mandatory parameter;
  • Buffer - Specifies the percentage of memory to reserve as a buffer in the virtual machine to be configured. Allowed values range from 5 to 2000. Set to -1 to disable this mandatory parameter;
  • MaximumAmountPerNumaNodeBytes - Specifies the maximum amount of memory per NUMA node in the virtual machine to be configured. Supports values such as 512MB, 1GB etc;
  • ResourcePoolName - Specifies the name of the memory resource pool for this virtual machine.

Output Parameters

  • errors - Any errors returned by the operation;
  • outcome - Outcome of the operation. Can be OK or FAIL;
  • warnings - Any warnings returned by the operation.

Set Processor

This operation will set the processor details for a specific Hyper-V Virtual Machine. The target VM must be in a shutdown state, as per the Set-VMProcessor documentation.

Input Parameters

  • VMName - The name of the Virtual Machine to perform the action against;
  • HostName - Optionally provide the Hyper-V host to perform the action on. NetBIOS names, IP addresses, and fully qualified domain names are allowable;
  • Count - Specifies the number of virtual processors for the virtual machine;
  • CompatibilityForMigrationEnabled - Specifies whether the virtual processor's features are to be limited for compatibility when migrating the virtual machine to another host;
  • CompatibilityForOlderOperatingSystemsEnabled - Specifies whether the virtual processor's features are to be limited for compatibility with older operating systems;
  • HwThreadCountPerCore - Specifies the number of virtual SMT threads exposed to the virtual machine;
  • Maximum - Specifies the maximum percentage of resources available to the virtual machine processor to be configured. Allowed values range from 0 to 100;
  • Reserve - Specifies the percentage of processor resources to be reserved for this virtual machine. Allowed values range from 0 to 100;
  • RelativeWeight - Specifies the priority for allocating the physical computer's processing power to this virtual machine relative to others. Allowed values range from 1 to 10000;
  • MaximumCountPerNumaNode - Specifies the maximum number of processors per NUMA node to be configured for the virtual machine;
  • MaximumCountPerNumaSocket - Specifies the maximum number of sockets per NUMA node to be configured for the virtual machine;
  • ResourcePoolName - Specifies the name of the processor resource pool to be used;
  • EnableHostResourceProtection - Specifies whether to enable host resource protection on the virtual machine;
  • ExposeVirtualizationExtensions - Specifies whether the hypervisor should expose the presence of virtualization extensions to the virtual machine, which enables support for nested virtualization.

Output Parameters

  • errors - Any errors returned by the operation;
  • outcome - Outcome of the operation. Can be OK or FAIL;
  • warnings - Any warnings returned by the operation.

New VHD

This operation will create a new Virtual Hard Disk, then mount, initialize, partition and format it so the drive is ready to use, before adding it to the target VM. See the New-VHD documentation for more information.

Input Parameters

  • VMName - The name of the Virtual Machine to perform the action against;
  • HostName - Optionally provide the Hyper-V host to perform the action on. NetBIOS names, IP addresses, and fully qualified domain names are allowable;
  • Path - The path and filename of the new VHD file;
  • ParentPath - Specifies the path to the parent of the differencing disk to be created (this parameter may be specified only for the creation of a differencing disk);
  • SourceDisk - Specifies the physical disk to be used as the source for the virtual hard disk to be created;
  • Fixed - Specifies that a fixed virtual hard disk is to be created;
  • SizeBytes - The maximum size, in bytes, of the virtual hard disk to be created. Examples: 1.5GB, 10GB, 1TB;
  • Differencing - Specifies that a differencing virtual hard disk is to be created;
  • Dynamic - Specifies that a dynamic virtual hard disk is to be created;
  • BlockSizeBytes - Specifies the block size, in bytes, of the virtual hard disk to be created. Examples: 128MB, 64MB;
  • LogicalSectorSizeBytes - Specifies the logical sector size, in bytes, of the virtual hard disk to be created. Valid values are 512 and 4096;
  • PhysicalSectorSizeBytes - Specifies the physical sector size, in bytes. Valid values are 512 and 4096;
  • FileSystem - Specifies the file system with which to format the volume. The acceptable values for this parameter are:NTFS, ReFS, exFAT, FAT32, and FAT;
  • NewFileSystemLabel - Specifies the label to use for the volume.

Output Parameters

  • errors - Any errors returned by the operation;
  • outcome - Outcome of the operation. Can be OK or FAIL;
  • warnings - Any warnings returned by the operation;
  • Path - The path of the new VHD;
  • VhdFormat - The format of the new VHD;
  • VhdType - The type of the new VHD;
  • FileSize - The current size of the new VHD file;
  • Size - The maximum size of the new VHD;
  • MinimumSize - The minimum size of the new VHD;
  • LogicalSectorSize - The Logical Sector size;
  • PhysicalSectorSize - The Physical Sector size;
  • BlockSize - The Block size;
  • ParentPath - The Parent Path;
  • DiskIdentifier - The disk identifier;
  • Alignment - The disk alignment;
  • Attached - The attached value;
  • DiskNumber - The disk number;
  • IsPMEMCompatible - Is the new disk PMEM compatible;
  • AddressAbstractionType - The address abstraction type;
  • Number - The new VDH number;
  • ControllerLocation - The controller location;
  • ControllerNumber - The controller number;
  • ControllerType - The controller type;
  • ID - The ID of the new VHD once attached to the VM;
  • Name - The name of the new VHD;

Get VHD

This operation will retrieve details about a Virtual Hard Disk, using either its Path or Disk Number. See the Get-VHD documentation for more information.

Input Parameters

  • HostName - Optionally provide the Hyper-V host to perform the action on. NetBIOS names, IP addresses, and fully qualified domain names are allowable;
  • Path - Specifies the path to the virtual hard disk file of the virtual hard disk to be retrieved. If a filename or relative path is specified, the path is calculated relative to the current working directory;
  • DiskNumber - Specifies the disk number associated with the virtual hard disk to be retrieved.

Output Parameters

  • errors - Any errors returned by the operation;
  • outcome - Outcome of the operation. Can be OK or FAIL;
  • warnings - Any warnings returned by the operation;
  • ComputerName - The name of the VM that the VHD is attached to;
  • Path - The path of the VHD;
  • VhdFormat - The format of the VHD;
  • VhdType - The type of the VHD;
  • FileSize - The current size of the VHD file;
  • Size - The maximum size of the VHD;
  • MinimumSize - The minimum size of the VHD;
  • LogicalSectorSize - The Logical Sector size;
  • PhysicalSectorSize - The Physical Sector size;
  • BlockSize - The Block size;
  • ParentPath - The Parent Path;
  • DiskIdentifier - The disk identifier;
  • FragmentationPercentage - The percentage of fragmentation;
  • Alignment - The disk alignment;
  • Attached - The attached value;
  • DiskNumber - The disk number;
  • IsPMEMCompatible - Is the disk PMEM compatible;
  • AddressAbstractionType - The address abstraction type;
  • Number - The VDH number.