-
Notifications
You must be signed in to change notification settings - Fork 726
/
Copy pathGet-SCSMObjectPrefix.ps1
105 lines (95 loc) · 4.94 KB
/
Get-SCSMObjectPrefix.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
function Get-SCSMObjectPrefix {
<#
.SYNOPSIS
Function to retrieve the Prefix used for the different WorkItem, Activities or Knowledge Article
.DESCRIPTION
Function to retrieve the Prefix used for the different WorkItem, Activities or Knowledge Article
.PARAMETER ClassName
Specified the ClassName you want to query
.EXAMPLE
Get-SCSMObjectPrefix
DependentActivity : DA
ManualActivity : MA
ParallelActivity : PA
ReviewActivity : RA
RunbookAutomationActivity : RB
SequentialActivity : SA
IncidentRequest : IR
ServiceRequest : SR
Change : CR
Knowledge : KA
Problem : PR
Release : RR
.EXAMPLE
Get-SCSMObjectPrefix -ClassName Change
CR
.NOTES
Francois-Xavier Cat
www.lazywinadmin
@lazywinadmin
github.com/lazywinadmin
.LINK
https://github.com/lazywinadmin/PowerShell
#>
[OutputType([psobject])]
param
(
[ValidateSet(
'DependentActivity',
'ManualActivity',
'ParallelActivity',
'ReviewActivity',
'RunbookAutomationActivity',
'SequentialActivity',
'IncidentRequest',
'ServiceRequest',
'Change',
'Knowledge',
'Problem',
'Release'
)]
[string]$ClassName
)
BEGIN {
Import-Module -Name Smlets
$ActivitySettingsObj = Get-SCSMObject -Class (Get-SCSMClass -Name "System.GlobalSetting.ActivitySettings")
$ChangeSettingsObj = Get-SCSMObject -Class (Get-SCSMClass -Name "System.GlobalSetting.ChangeSettings")
$KnowledgedSettingsObj = Get-SCSMObject -Class (Get-SCSMClass -Name "System.GlobalSetting.KnowledgeSettings")
$ProblemSettingsObj = Get-SCSMObject -Class (Get-SCSMClass -Name "System.GlobalSetting.ProblemSettings")
$ReleaseSettingsObj = Get-SCSMObject -Class (Get-SCSMClass -Name "System.GlobalSetting.ReleaseSettings")
$ServiceRequestSettingsObj = Get-SCSMObject -Class (Get-SCSMClass -Name "System.GlobalSetting.ServiceRequestSettings")
$IncidentRequestSettingsObj = Get-SCSMObject -Class (Get-SCSMClass -Name "System.WorkItem.Incident.GeneralSetting")
}
PROCESS {
Switch ($ClassName) {
"DependentActivity" { $ActivitySettingsObj.SystemWorkItemActivityDependentActivityIdPrefix }
"ManualActivity" { $ActivitySettingsObj.SystemWorkItemActivityManualActivityIdPrefix }
"ParallelActivity" { $ActivitySettingsObj.SystemWorkItemActivityParallelActivityIdPrefix }
"ReviewActivity" { $ActivitySettingsObj.SystemWorkItemActivityReviewActivityIdPrefix }
"RunbookAutomationActivity" { $ActivitySettingsObj.MicrosoftSystemCenterOrchestratorRunbookAutomationActivityBaseIdPrefix }
"SequentialActivity" { $ActivitySettingsObj.SystemWorkItemActivitySequentialActivityIdPrefix }
"IncidentRequest" { $IncidentRequestSettingsObj.PrefixForId }
"ServiceRequest" { $ServiceRequestSettingsObj.ServiceRequestPrefix }
"Change" { $ChangeSettingsObj.SystemWorkItemChangeRequestIdPrefix }
"Knowledge" { $KnowledgedSettingsObj.SystemKnowledgeArticleIdPrefix }
"Problem" { $ProblemSettingsObj.ProblemIdPrefix }
"Release" { $ReleaseSettingsObj.SystemWorkItemReleaseRecordIdPrefix }
default {
[pscustomobject][ordered]@{
"DependentActivity" = $ActivitySettingsObj.SystemWorkItemActivityDependentActivityIdPrefix
"ManualActivity" = $ActivitySettingsObj.SystemWorkItemActivityManualActivityIdPrefix
"ParallelActivity" = $ActivitySettingsObj.SystemWorkItemActivityParallelActivityIdPrefix
"ReviewActivity" = $ActivitySettingsObj.SystemWorkItemActivityReviewActivityIdPrefix
"RunbookAutomationActivity" = $ActivitySettingsObj.MicrosoftSystemCenterOrchestratorRunbookAutomationActivityBaseIdPrefix
"SequentialActivity" = $ActivitySettingsObj.SystemWorkItemActivitySequentialActivityIdPrefix
"IncidentRequest" = $IncidentRequestSettingsObj.PrefixForId
"ServiceRequest" = $ServiceRequestSettingsObj.ServiceRequestPrefix
"Change" = $ChangeSettingsObj.SystemWorkItemChangeRequestIdPrefix
"Knowledge" = $KnowledgedSettingsObj.SystemKnowledgeArticleIdPrefix
"Problem" = $ProblemSettingsObj.ProblemIdPrefix
"Release" = $ReleaseSettingsObj.SystemWorkItemReleaseRecordIdPrefix
}
}
}
}
}