I am experimenting with ContextMenuStrip
in Windows Forms for PowerShell.
$contextMenuStrip1 = New-Object System.Windows.Forms.ContextMenuStrip
#creation element1 of menu
[System.Windows.Forms.ToolStripItem]$toolStripItem1 = New-Object System.Windows.Forms.ToolStripMenuItem
$toolStripItem1.Text = "AD: Disable User"
$toolStripItem1.Add_Click({ disableuser })
$contextMenuStrip1.Items.Add($toolStripItem1)
#creation element2 of menu
[System.Windows.Forms.ToolStripItem]$toolStripItem2 = New-Object System.Windows.Forms.ToolStripMenuItem
$toolStripItem2.Text = "AD: Reset password"
$toolStripItem2.Add_Click({ resetpassword })
$contextMenuStrip1.Items.Add($toolStripItem2)
#creation element3 of menu
[System.Windows.Forms.ToolStripItem]$toolStripItem3 = New-Object System.Windows.Forms.ToolStripMenuItem
$toolStripItem3.Text = "AD: Move to another OU"
$toolStripItem3.Add_Click({ moveADuser })
$contextMenuStrip1.Items.Add($toolStripItem3)
I want to create a nested menu, though. I have searched the net to no avail.