Debug-VM

Debugs a virtual machine.

Syntax

Debug-VM
     [-CimSession <CimSession[]>]
     [-ComputerName <String[]>]
     [-Credential <PSCredential[]>]
     [-Name] <String[]>
     [-Force]
     [-AsJob]
     [-Passthru]
     [-InjectNonMaskableInterrupt]
     [-WhatIf]
     [-Confirm]
     [<CommonParameters>]
Debug-VM
     [-VM] <VirtualMachine[]>
     [-Force]
     [-AsJob]
     [-Passthru]
     [-InjectNonMaskableInterrupt]
     [-WhatIf]
     [-Confirm]
     [<CommonParameters>]

Description

The Debug-VM cmdlet debugs a virtual machine.

Examples

Example 1

PS C:\> debug-vm "VM to Debug" -InjectNonMaskableInterrupt -Force

This example injects a non-maskable interrupt into the virtual machine named "VM to Debug". A kernel debugger should be connected to the guest operating system before attempting to do this.

Parameters

-AsJob

Runs the cmdlet as a background job.

Type: SwitchParameter
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-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 or Get-CimSession cmdlet. The default is the current session on the local computer.

Type: CimSession [ ]
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-ComputerName

Specifies an array of Hyper-V hosts. The cmdlet debugs the virtual machines on the hosts you specify.

Type: String [ ]
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Confirm

Prompts you for confirmation before running the cmdlet.

Type: SwitchParameter
Aliases: cf
Position: Named
Default value: False
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.

Type: PSCredential [ ]
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Force

Forces the command to run without asking for user confirmation.

Type: SwitchParameter
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-InjectNonMaskableInterrupt

Indicates that the cmdlet sends a nonmaskable interrupt (NMI) to the virtual machine. An interrupt handler must process a nonmaskable interrupt.

Type: SwitchParameter
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Name

Specifies an array of names of virtual machines to be debugged.

Type: String [ ]
Aliases: VMName
Position: 0
Default value: None
Accept pipeline input: True
Accept wildcard characters: False

-Passthru

Returns an object representing the item with which you are working. By default, this cmdlet does not generate any output.

Type: SwitchParameter
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-VM

Specifies an array of virtual machine objects that are to be debugged. To obtain virtual machine objects, use the Get-VM cmdlet.

Type: VirtualMachine [ ]
Position: 0
Default value: None
Accept pipeline input: True
Accept wildcard characters: False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type: SwitchParameter
Aliases: wi
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

Outputs

Microsoft.HyperV.PowerShell.VirtualMachine

Notes

Shielded virtual machines do not support debugging or nonmaskable interrupts. Debug-VM will return an error if you try to debug a shielded VM.

  • Configuring Automatic Debugging