< Back
Add-MenuItem
Post
NAME Add-MenuItem
SYNOPSIS
Add a Menu Item to a menu.
SYNTAX
Add-MenuItem [-Menu] <String> [-MenuItem] <PSObject> [<CommonParameters>]
DESCRIPTION
Add a Menu Item to a menu. This cmdlet support input (Menu Items) from the pipeline.
PARAMETERS
-Menu <String>
Required? true
Position? 1
Default value
Accept pipeline input? false
Accept wildcard characters? false
-MenuItem <PSObject>
Required? true
Position? 2
Default value
Accept pipeline input? true (ByValue)
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
OUTPUTS
NOTES
NAME: Add-MenuItem
AUTHOR: Tore Groneng tore@firstpoint.no @toregroneng tore.groneng@gmail.com
LASTEDIT: Aug 2016
KEYWORDS: General scripting Controller Menu
-------------------------- EXAMPLE 1 --------------------------
C:>$items = Get-MenuItem -MenuName main
C:> $items | Add-MenuItem -Menu subMenu
This will copy Menu Items from the main Menu and add them to the Menu subMenu.
-------------------------- EXAMPLE 2 --------------------------
C:>$newMenuItem = @{
Name = "UnlockUser"
DisplayName = "Unlock a user"
Action = { Show-Command -Name Unlock-UserObject }
DisableConfirm = $true
}
C:> $item = New-MenuItem @newMenuItem
C:> $item | Add-MenuItem -Menu main
This will create a new Menu Item and add it to the main Menu using the pipeline.
-------------------------- EXAMPLE 3 --------------------------
C:>$newMenuItem = @{
Name = "UnlockUser"
DisplayName = "Unlock a user"
Action = { Show-Command -Name Unlock-UserObject }
DisableConfirm = $true
}
C:> $item = New-MenuItem @newMenuItem
C:> Add-MenuItem -Menu main -MenuItem $item
This will create a new Menu Item and add it to the main Menu.
RELATED LINKS
SYNOPSIS
Add a Menu Item to a menu.
SYNTAX
Add-MenuItem [-Menu] <String> [-MenuItem] <PSObject> [<CommonParameters>]
DESCRIPTION
Add a Menu Item to a menu. This cmdlet support input (Menu Items) from the pipeline.
PARAMETERS
-Menu <String>
Required? true
Position? 1
Default value
Accept pipeline input? false
Accept wildcard characters? false
-MenuItem <PSObject>
Required? true
Position? 2
Default value
Accept pipeline input? true (ByValue)
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
OUTPUTS
NOTES
NAME: Add-MenuItem
AUTHOR: Tore Groneng tore@firstpoint.no @toregroneng tore.groneng@gmail.com
LASTEDIT: Aug 2016
KEYWORDS: General scripting Controller Menu
-------------------------- EXAMPLE 1 --------------------------
C:>$items = Get-MenuItem -MenuName main
C:> $items | Add-MenuItem -Menu subMenu
This will copy Menu Items from the main Menu and add them to the Menu subMenu.
-------------------------- EXAMPLE 2 --------------------------
C:>$newMenuItem = @{
Name = "UnlockUser"
DisplayName = "Unlock a user"
Action = { Show-Command -Name Unlock-UserObject }
DisableConfirm = $true
}
C:> $item = New-MenuItem @newMenuItem
C:> $item | Add-MenuItem -Menu main
This will create a new Menu Item and add it to the main Menu using the pipeline.
-------------------------- EXAMPLE 3 --------------------------
C:>$newMenuItem = @{
Name = "UnlockUser"
DisplayName = "Unlock a user"
Action = { Show-Command -Name Unlock-UserObject }
DisableConfirm = $true
}
C:> $item = New-MenuItem @newMenuItem
C:> Add-MenuItem -Menu main -MenuItem $item
This will create a new Menu Item and add it to the main Menu.
RELATED LINKS