diff --git a/docset/winserver2025-ps/hyper-v/Add-VMAssignableDevice.md b/docset/winserver2025-ps/hyper-v/Add-VMAssignableDevice.md new file mode 100644 index 0000000000..8524d0f863 --- /dev/null +++ b/docset/winserver2025-ps/hyper-v/Add-VMAssignableDevice.md @@ -0,0 +1,275 @@ +--- +description: Assigns a device to a virtual machine. +external help file: Microsoft.HyperV.PowerShell.Cmdlets.dll-Help.xml +Module Name: Hyper-V +ms.date: 06/12/2024 +online version: https://learn.microsoft.com/powershell/module/hyper-v/add-vmassignabledevice?view=windowsserver2025-ps&wt.mc_id=ps-gethelp +schema: 2.0.0 +title: Add-VMAssignableDevice +--- + +# Add-VMAssignableDevice + +## SYNOPSIS +Adds an assignable device to a specific virtual machine. + +## SYNTAX + +### VMName (Default) + +``` +Add-VMAssignableDevice [-CimSession ] [-ComputerName ] + [-Credential ] [-VMName] [-InstancePath ] + [-LocationPath ] [-VirtualFunction ] [-ResourcePoolName ] [-Passthru] + [-WhatIf] [-Confirm] [] +``` + +### VMObject + +``` +Add-VMAssignableDevice [-VM] [-InstancePath ] [-LocationPath ] + [-VirtualFunction ] [-ResourcePoolName ] [-Passthru] [-WhatIf] [-Confirm] + [] +``` + +## DESCRIPTION + +The `Add-VMAssignableDevice` cmdlet assigns a physical device to a specified virtual machine (VM). +This is commonly used for tasks such as attaching GPUs or network adapters directly to a VM to +enhance performance for specific applications or workloads. The device can be specified through its +instance path, location path, or assignable device object. + +## EXAMPLES + +### Example 1 + +```powershell +Add-VMAssignableDevice -VMName "MyVM" -InstancePath "PCIROOT(0)#PCI(0300)#PCI(0000)" +``` + +This example attaches a physical device, identified by its instance path, to the virtual machine +named **MyVM**. + +## PARAMETERS + +### -CimSession + +Runs the cmdlet in a remote session or on a remote computer. Enter a computer name or a session +object, such as the output of a [New-CimSession](/powershell/module/cimcmdlets/new-cimsession) +or [Get-CimSession](/powershell/module/cimcmdlets/get-cimsession) cmdlet. The default is the +current session on the local computer. + +```yaml +Type: CimSession[] +Parameter Sets: VMName +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ComputerName + +Specifies one or more Hyper-V hosts on which the assignable devices are to be retrieved. NetBIOS +names, IP addresses, and fully qualified domain names are allowed. The default is the local +computer. Use localhost or a dot (`.`) to specify the local computer explicitly. + +```yaml +Type: String[] +Parameter Sets: VMName +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Credential + +Specifies one or more user accounts that have permission to perform this action. The default is the +current user. + +```yaml +Type: PSCredential[] +Parameter Sets: VMName +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InstancePath + +Represents the Device Instance path in the host machine. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -LocationPath + +Specifies the location path to the assignable device + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Passthru + +Returns an object for each process that the cmdlet started. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourcePoolName + +Specifies the name of the resource pool to which the device is to be assigned. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -VirtualFunction + +Specifies the number of the virtual function (VF) of an SR-IOV-capable network adapter assigned to +the virtual machine. + +```yaml +Type: UInt16 +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -VM + +Specifies the virtual machine to which the device is to be assigned. + +```yaml +Type: VirtualMachine[] +Parameter Sets: VMObject +Aliases: + +Required: True +Position: 0 +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -VMName + +Specifies the name of the virtual machine to which the device is to be assigned. + +```yaml +Type: String[] +Parameter Sets: VMName +Aliases: + +Required: True +Position: 0 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm + +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf + +Shows what would happen if the cmdlet runs. The cmdlet is not run. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters + +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, +-InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, +-WarningAction, and -WarningVariable. For more information, see +[about_CommonParameters](/powershell/module/microsoft.powershell.core/about/about_commonparameters). + +## INPUTS + +### Microsoft.HyperV.PowerShell.VirtualMachine[] + +## OUTPUTS + +### Microsoft.HyperV.PowerShell.VMAssignedDevice + +## NOTES + +## RELATED LINKS + +[Get-VMAssignableDevice](get-vmassignabledevice.md) + +[Remove-VMAssignableDevice](remove-vmassignabledevice.md) diff --git a/docset/winserver2025-ps/hyper-v/Get-VMAssignableDevice.md b/docset/winserver2025-ps/hyper-v/Get-VMAssignableDevice.md new file mode 100644 index 0000000000..66fb3601d4 --- /dev/null +++ b/docset/winserver2025-ps/hyper-v/Get-VMAssignableDevice.md @@ -0,0 +1,194 @@ +--- +description: Retrieves information about a device assigned to a virtual machine. +external help file: Microsoft.HyperV.PowerShell.Cmdlets.dll-Help.xml +Module Name: Hyper-V +ms.date: 06/12/2024 +online version: https://learn.microsoft.com/powershell/module/hyper-v/get-vmassignabledevice?view=windowsserver2025-ps&wt.mc_id=ps-gethelp +schema: 2.0.0 +title: Get-VMAssignableDevice +--- + +# Get-VMAssignableDevice + +## SYNOPSIS +Retrieves information about the assignable device from a specific virtual machine. + +## SYNTAX + +### VMName (Default) + +``` +Get-VMAssignableDevice [-CimSession ] [-ComputerName ] + [-Credential ] [-VMName] [-InstancePath ] + [-LocationPath ] [] +``` + +### VMObject + +``` +Get-VMAssignableDevice [-VM] [-InstancePath ] [-LocationPath ] + [] +``` + +## DESCRIPTION + +The `Get-VMAssignableDevice` cmdlet retrieves information about the assignable devices that are +associated with a specific virtual machine (VM). This cmdlet can be used to list all assignable +devices that can be attached to a VM or to retrieve details about specific devices that are already +assigned. The retrieved information can include the device's instance path, location path, and +other relevant properties. + +## EXAMPLES + +### Example 1 + +```powershell +Get-VMAssignableDevice -VMName "MyVM" +``` + +This example retrieves all assignable devices associated with the virtual machine named **MyVM**. + +## PARAMETERS + +### -CimSession + +Runs the cmdlet in a remote session or on a remote computer. Enter a computer name or a session +object, such as the output of a [New-CimSession](/powershell/module/cimcmdlets/new-cimsession) +or [Get-CimSession](/powershell/module/cimcmdlets/get-cimsession) cmdlet. The default is the +current session on the local computer. + +```yaml +Type: CimSession[] +Parameter Sets: VMName +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ComputerName + +Specifies one or more Hyper-V hosts from which the assignable devices are to be retrieved. NetBIOS +names, IP addresses, and fully qualified domain names are allowed. The default is the local +computer. Use localhost or a dot (`.`) to specify the local computer explicitly. + +```yaml +Type: String[] +Parameter Sets: VMName +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Credential + +Retrieves one or more user accounts that have permission to perform this action. The default is the +current user. + +```yaml +Type: PSCredential[] +Parameter Sets: VMName +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InstancePath + +Represents the Device Instance path in the host machine. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -LocationPath + +Specifies the location path to the assignable device + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -VM + +Retrieves the virtual machine which a device is assigned. + +```yaml +Type: VirtualMachine[] +Parameter Sets: VMObject +Aliases: + +Required: True +Position: 0 +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -VMName + +Retrieves the names of the assignable devices assigned to the specified virtual machine. + +```yaml +Type: String[] +Parameter Sets: VMName +Aliases: + +Required: True +Position: 0 +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### CommonParameters + +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, +-InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, +-WarningAction, and -WarningVariable. For more information, see +[about_CommonParameters](/powershell/module/microsoft.powershell.core/about/about_commonparameters). + +## INPUTS + +### System.String[] + +### Microsoft.HyperV.PowerShell.VirtualMachine[] + +## OUTPUTS + +### Microsoft.HyperV.PowerShell.VMAssignedDevice + +## NOTES + +## RELATED LINKS + +[Add-VMAssignableDevice](add-vmassignabledevice.md) + +[Remove-VMAssignableDevice](remove-vmassignabledevice.md) diff --git a/docset/winserver2025-ps/hyper-v/Hyper-V.md b/docset/winserver2025-ps/hyper-v/Hyper-V.md index a78f953d39..32b28c8a90 100644 --- a/docset/winserver2025-ps/hyper-v/Hyper-V.md +++ b/docset/winserver2025-ps/hyper-v/Hyper-V.md @@ -5,7 +5,7 @@ Help Version: 5.0.2.1 Locale: en-US Module Guid: af4bddd0-8583-4ff2-84b2-a33f5c8de8a7 Module Name: Hyper-V -ms.date: 12/20/2016 +ms.date: 06/12/2024 title: Hyper-V --- # Hyper-V Module @@ -16,6 +16,9 @@ This reference provides cmdlet descriptions and syntax for all Hyper-V-specific ## Hyper-V Cmdlets +### [Add-VMAssignableDevice](./Add-VMAssignableDevice.md) +Adds an assignable device to a specific virtual machine. + ### [Add-VMDvdDrive](./Add-VMDvdDrive.md) Adds a DVD drive to a virtual machine. @@ -31,6 +34,9 @@ Adds group members to a virtual machine group. ### [Add-VMHardDiskDrive](./Add-VMHardDiskDrive.md) Adds a hard disk drive to a virtual machine. +### [Add-VMHostAssignableDevice](./Add-VMHostAssignableDevice.md) +Adds an assignable device to a virtual machine (VM) host. + ### [Add-VMMigrationNetwork](./Add-VMMigrationNetwork.md) Adds a network for virtual machine migration on one or more virtual machine hosts. @@ -124,6 +130,9 @@ Removes a host bus adapter from a virtual storage area network (SAN). ### [Dismount-VHD](./Dismount-VHD.md) Dismounts a virtual hard disk. +### [Dismount-VMHostAssignableDevice](./Dismount-VMHostAssignableDevice.md) +Dismounts a device from a virtual machine (VM) host. + ### [Enable-VMConsoleSupport](./Enable-VMConsoleSupport.md) Enables keyboard, video, and mouse for virtual machines. @@ -169,6 +178,9 @@ Gets information about a checkpoint in a VHD set. ### [Get-VM](./Get-VM.md) Gets the virtual machines from one or more Hyper-V hosts. +### [Get-VMAssignableDevice](./Get-VMAssignableDevice.md) +Retrieves information about the assignable device from a specific virtual machine. + ### [Get-VMBios](./Get-VMBios.md) Gets the BIOS of a virtual machine or snapshot. @@ -202,6 +214,9 @@ Gets the virtual hard disk drives attached to one or more virtual machines. ### [Get-VMHost](./Get-VMHost.md) Gets a Hyper-V host. +### [Get-VMHostAssignableDevice](./Get-VMHostAssignableDevice.md) +Retrieves device information assigned to a virtual machine (VM) host. + ### [Get-VMHostCluster](./Get-VMHostCluster.md) Gets virtual machine host clusters. @@ -252,7 +267,6 @@ Gets members of a routing domain. ### [Get-VMNetworkAdapterTeamMapping](./Get-VMNetworkAdapterTeamMapping.md) - ### [Get-VMNetworkAdapterVlan](./Get-VMNetworkAdapterVlan.md) Gets the virtual LAN settings configured on a virtual network adapter. @@ -349,6 +363,9 @@ Merges virtual hard disks. ### [Mount-VHD](./Mount-VHD.md) Mounts one or more virtual hard disks. +### [Mount-VMHostAssignableDevice](./Mount-VMHostAssignableDevice.md) +Mounts a device to a virtual machine (VM) host. + ### [Move-VM](./Move-VM.md) Moves a virtual machine to a new Hyper-V host. @@ -391,6 +408,9 @@ Removes a checkpoint from a VHD set file. ### [Remove-VM](./Remove-VM.md) Deletes a virtual machine. +### [Remove-VMAssignableDevice](./Remove-VMAssignableDevice.md) +Removes information about the assignable devices from a specific virtual machine. + ### [Remove-VMDvdDrive](./Remove-VMDvdDrive.md) Deletes a DVD drive from a virtual machine. @@ -409,6 +429,9 @@ Removes members from a virtual machine group. ### [Remove-VMHardDiskDrive](./Remove-VMHardDiskDrive.md) Deletes a hard disk drive from a virtual machine. +### [Remove-VMHostAssignableDevice](./Remove-VMHostAssignableDevice.md) +Removes a device assigned to a virtual machine (VM) host. + ### [Remove-VMMigrationNetwork](./Remove-VMMigrationNetwork.md) Removes a network from use with migration. @@ -426,7 +449,6 @@ Removes a routing domain from a virtual network adapter. ### [Remove-VMNetworkAdapterTeamMapping](./Remove-VMNetworkAdapterTeamMapping.md) - ### [Remove-VMRemoteFx3dVideoAdapter](./Remove-VMRemoteFx3dVideoAdapter.md) Removes a RemoteFX 3D video adapter from a virtual machine. @@ -579,7 +601,6 @@ Sets virtual subnets on a routing domain. ### [Set-VMNetworkAdapterTeamMapping](./Set-VMNetworkAdapterTeamMapping.md) - ### [Set-VMNetworkAdapterVlan](./Set-VMNetworkAdapterVlan.md) Configures the virtual LAN settings for the traffic through a virtual network adapter. diff --git a/docset/winserver2025-ps/hyper-v/Remove-VMAssignableDevice.md b/docset/winserver2025-ps/hyper-v/Remove-VMAssignableDevice.md new file mode 100644 index 0000000000..4f768144a3 --- /dev/null +++ b/docset/winserver2025-ps/hyper-v/Remove-VMAssignableDevice.md @@ -0,0 +1,257 @@ +--- +description: Removes a device assigned to a virtual machine. +external help file: Microsoft.HyperV.PowerShell.Cmdlets.dll-Help.xml +Module Name: Hyper-V +ms.date: 06/12/2024 +online version: https://learn.microsoft.com/powershell/module/hyper-v/remove-vmassignabledevice?view=windowsserver2025-ps&wt.mc_id=ps-gethelp +schema: 2.0.0 +title: Remove-VMAssignableDevice +--- + +# Remove-VMAssignableDevice + +## SYNOPSIS +Removes information about the assignable devices from a specific virtual machine. + +## SYNTAX + +### VMName (Default) + +``` +Remove-VMAssignableDevice [-CimSession ] [-ComputerName ] + [-Credential ] [-VMName] [-InstancePath ] + [-LocationPath ] [-Passthru] [-WhatIf] [-Confirm] [] +``` + +### Object + +``` +Remove-VMAssignableDevice [-VMAssignableDevice] [-Passthru] [-WhatIf] + [-Confirm] [] +``` + +## DESCRIPTION + +The `Remove-VMAssignableDevice` cmdlet removes an assignable device from a specified virtual +machine (VM). This is often used in scenarios where a physical device, such as a GPU or network +adapter, was previously assigned to a VM and needs to be unassigned. + +## EXAMPLES + +### Example 1 + +```powershell +$params = @{ +VMName = "MyVM" +InstancePath = "PCIROOT(0)#PCI(0300)#PCI(0000)#PCI(0800)#PCI(0000)#PCI(1000)" +} +Remove-VMAssignableDevice $params +``` + +This example removes a specific assignable device, identified by its instance path, from the +virtual machine named **MyVM**. + +### Example 2 + +```powershell +$params = @{ +VMName = "MyVM" +} +$vm = Get-VMAssignableDevice @params | Where-Object { $_.ResourcePoolName -eq "GpuChildPool" } +$vm | Remove-VMAssignableDevice +``` + +This example removes a specific assignable device, identified by the ResourcePoolName property +**GpuChildPool**, from the virtual machine named **MyVM**. + +## PARAMETERS + +### -CimSession + +Runs the cmdlet in a remote session or on a remote computer. Enter a computer name or a session +object, such as the output of a [New-CimSession](/powershell/module/cimcmdlets/new-cimsession) +or [Get-CimSession](/powershell/module/cimcmdlets/get-cimsession) cmdlet. The default is the +current session on the local computer. + +```yaml +Type: CimSession[] +Parameter Sets: VMName +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ComputerName + +Specifies one or more Hyper-V hosts on the virtual network adapters are to be retrieved. NetBIOS +names, IP addresses, and fully qualified domain names are allowed. The default is the local +computer. Use localhost or a dot (`.`) to specify the local computer explicitly. + +```yaml +Type: String[] +Parameter Sets: VMName +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Credential + +Specifies one or more user accounts that have permission to perform this action. The default is the +current user. + +```yaml +Type: PSCredential[] +Parameter Sets: VMName +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InstancePath + +Removes the Device Instance path in the host machine. + +```yaml +Type: String +Parameter Sets: VMName +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -LocationPath + +Specifies the location path to the assignable device. + +```yaml +Type: String +Parameter Sets: VMName +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Passthru + +Returns an object for each process that the cmdlet started. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -VMAssignableDevice + +Specifies the assignable device object that you want to remove from the virtual machine. This is +usually an object retrieved from a cmdlet like `Get-VMAssignableDevice`. + +```yaml +Type: VMAssignedDevice[] +Parameter Sets: Object +Aliases: + +Required: True +Position: 0 +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -VMName + +Specifies the name of the virtual machine from which you want to remove the assignable device. + +```yaml +Type: String[] +Parameter Sets: VMName +Aliases: + +Required: True +Position: 0 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm + +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf + +Shows what would happen if the cmdlet runs. The cmdlet is not run. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters + +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, +-InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, +-WarningAction, and -WarningVariable. For more information, see +[about_CommonParameters](/powershell/module/microsoft.powershell.core/about/about_commonparameters). + +## INPUTS + +### Microsoft.HyperV.PowerShell.VMAssignedDevice[] + +## OUTPUTS + +### Microsoft.HyperV.PowerShell.VMAssignedDevice + +## NOTES + +## RELATED LINKS + +[Add-VMAssignableDevice](add-vmassignabledevice.md) + +[Get-VMAssignableDevice](get-vmassignabledevice.md)