Public/Remove-IdoItDialog.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
Function Remove-IdoItDialog {
    <#
        .SYNOPSIS
        Remove-IdoItDialog

        .DESCRIPTION
        Removes a value from a dialog+ property

        .PARAMETER Category
        This parameter takes a constant name of a specific category

        .PARAMETER Property
        This is the name of the dialog+ property you want to remove the value

        .PARAMETER ElementId
        This is the id of the element you want remove

        .EXAMPLE
        PS> Remove-IdoItDialog -Category 'C__CATG__CPU' -Property 'Manufacturer' -ElementId 123

        Removes the element id 123 from the Dialog+ list Manufacturer

        .NOTES
        Version
        0.1.0 29.12.2017 CB initial release
    #>

        [CmdletBinding( SupportsShouldProcess = $True, ConfirmImpact = 'High')]
        Param (
            [Parameter( Mandatory = $True, Position = 0)]
            [String]$Category,

            [Parameter( Mandatory = $True, Position = 1)]
            [String]$Property,

            [Parameter( Mandatory = $True, Position = 3)]
            [Int]$ElementId
        )

        $Params = @{}
        $Params.Add("category",$Category)
        $Params.Add("property",$Property)
        $Params.Add("entry_id",$ElementId)

        If ($PSCmdlet.ShouldProcess("Removing dialog entry id $ElementID for $Category - $Property")) {
            $ResultObj = Invoke-IdoIt -Method "cmdb.dialog.delete" -Params $Params

            Return $ResultObj
        }
    }