Skip to content

Commit eaa517d

Browse files
committed
replace all tabs by spaces
1 parent d7c7ba7 commit eaa517d

File tree

75 files changed

+1165
-1157
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+1165
-1157
lines changed

SCSM-Add-SCSMReviewActivityReviewer/Add-SCSMReviewActivityReviewer.ps1

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,67 +3,67 @@
33
<#
44
.SYNOPSIS
55
Function to add a reviewer to a Review Activity item
6-
6+
77
.DESCRIPTION
88
Function to add a reviewer to a Review Activity item
9-
9+
1010
.PARAMETER UserName
1111
Specifies the UserName to add
12-
12+
1313
.PARAMETER Veto
1414
Specifies the Veto. Default is False.
15-
15+
1616
.PARAMETER MustVote
1717
Specifies if the Vote is required. Default is False.
18-
18+
1919
.PARAMETER WorkItemID
2020
Specifies the WorkItem ID of the Review Activity
21-
21+
2222
.EXAMPLE
2323
PS C:\> Add-SCSMReviewActivityReviewer -UserName 'francois-xavier' -veto $true -WorkItemID '2aa822b0-b144-3acf-bee3-9a11714c5de0'
24-
24+
2525
.NOTES
2626
Francois-Xavier Cat
2727
@lazywinadm
2828
www.lazywinadmin.com
29-
29+
3030
1.0 Based on Cireson's consultant function
3131
#>
3232
[CmdletBinding()]
3333
PARAM
3434
(
3535
[System.String]$UserName,
36-
36+
3737
[Boolean]$veto = $false,
38-
38+
3939
[Boolean]$mustvote = $false,
40-
40+
4141
$WorkItemID
4242
)
43-
43+
4444
BEGIN { Import-Module -Name SMLets -ErrorAction Stop }
4545
PROCESS
4646
{
4747
# Retrieve the Active Directory User Class
4848
$ADUserClassID = '10a7f898-e672-ccf3-8881-360bfb6a8f9a'
4949
$ADUserClassObject = Get-ScsmClass -Id $ADUserClassID
50-
50+
5151
$ScsmUser = Get-ScsmObject -class $ADUserClassObject -filter "Username -eq $UserName"
52-
52+
5353
if ($ScsmUser)
5454
{
5555
# Direct Reviewer add SCSM user by guid
5656
$RelationShipClass_HasReviewer = Get-SCSMRelationshipClass -name "System.ReviewActivityHasReviewer"
5757
$RelationShipClass_ReviewerIsUser = Get-SCSMRelationshipClass -name "System.ReviewerIsUser"
5858
$Class_ReviewerClass = Get-SCSMClass -name "System.Reviewer$"
59-
59+
6060
# Hashtable for reviewer arguments
6161
$ReviewerArgs = @{ ReviewerID = "{0}"; Mustvote = $mustvote; Veto = $veto }
62-
62+
6363
$Reviewer = new-scsmobject -class $class_ReviewerClass -propertyhashtable $ReviewerArgs -nocommit
64-
64+
6565
$WorkItem = Get-SCSMObject -Class (Get-SCSMClass -Name System.WorkItem.Activity.ReviewActivity$) -filter "ID -eq '$WorkItemID'"
66-
66+
6767
$reviewerStep1 = New-SCSMRelationshipObject -nocommit -Relationship $RelationShipClass_HasReviewer -Source $WorkItem -Target $Reviewer
6868
$reviewerStep2 = New-SCSMRelationshipObject -nocommit -Relationship $RelationShipClass_ReviewerIsUser -Source $Reviewer -Target $ScsmUser
6969
$reviewerStep1.Commit()
Lines changed: 60 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,63 @@
11
Function Add-SCSMServiceRequestComment
22
{
3-
param (
4-
[parameter(Mandatory = $True, Position = 0)]
5-
$SRObject,
6-
7-
[parameter(Mandatory = $True, Position = 1)]
8-
$Comment,
9-
10-
[parameter(Mandatory = $True, Position = 2)]
11-
$EnteredBy,
12-
13-
[parameter(Mandatory = $False, Position = 3)]
14-
[switch]$AnalystComment,
15-
16-
[parameter(Mandatory = $False, Position = 4)]
17-
[switch]$IsPrivate
18-
)
19-
20-
# Make sure that the SR Object it passed to the function
21-
If ($SRObject.Id -ne $NULL)
22-
{
23-
24-
25-
If ($AnalystComment)
26-
{
27-
$CommentClass = "System.WorkItem.TroubleTicket.AnalystCommentLog"
28-
$CommentClassName = "AnalystCommentLog"
29-
}
30-
else
31-
{
32-
$CommentClass = "System.WorkItem.TroubleTicket.UserCommentLog"
33-
$CommentClassName = "EndUserCommentLog"
34-
}
35-
36-
# Generate a new GUID for the comment
37-
$NewGUID = ([guid]::NewGuid()).ToString()
38-
39-
# Create the object projection with properties
40-
$Projection = @{
41-
__CLASS = "System.WorkItem.ServiceRequest";
42-
__SEED = $SRObject;
43-
EndUserCommentLog = @{
44-
__CLASS = $CommentClass;
45-
__OBJECT = @{
46-
Id = $NewGUID;
47-
DisplayName = $NewGUID;
48-
Comment = $Comment;
49-
EnteredBy = $EnteredBy;
50-
EnteredDate = (Get-Date).ToUniversalTime();
51-
IsPrivate = $IsPrivate.ToBool();
52-
}
53-
}
54-
}
55-
56-
# Create the actual comment
57-
New-SCSMObjectProjection -Type "System.WorkItem.ServiceRequestProjection" -Projection $Projection
58-
}
59-
else
60-
{
61-
Throw "Invalid Service Request Object!"
62-
}
3+
param (
4+
[parameter(Mandatory = $True, Position = 0)]
5+
$SRObject,
6+
7+
[parameter(Mandatory = $True, Position = 1)]
8+
$Comment,
9+
10+
[parameter(Mandatory = $True, Position = 2)]
11+
$EnteredBy,
12+
13+
[parameter(Mandatory = $False, Position = 3)]
14+
[switch]$AnalystComment,
15+
16+
[parameter(Mandatory = $False, Position = 4)]
17+
[switch]$IsPrivate
18+
)
19+
20+
# Make sure that the SR Object it passed to the function
21+
If ($SRObject.Id -ne $NULL)
22+
{
23+
24+
25+
If ($AnalystComment)
26+
{
27+
$CommentClass = "System.WorkItem.TroubleTicket.AnalystCommentLog"
28+
$CommentClassName = "AnalystCommentLog"
29+
}
30+
else
31+
{
32+
$CommentClass = "System.WorkItem.TroubleTicket.UserCommentLog"
33+
$CommentClassName = "EndUserCommentLog"
34+
}
35+
36+
# Generate a new GUID for the comment
37+
$NewGUID = ([guid]::NewGuid()).ToString()
38+
39+
# Create the object projection with properties
40+
$Projection = @{
41+
__CLASS = "System.WorkItem.ServiceRequest";
42+
__SEED = $SRObject;
43+
EndUserCommentLog = @{
44+
__CLASS = $CommentClass;
45+
__OBJECT = @{
46+
Id = $NewGUID;
47+
DisplayName = $NewGUID;
48+
Comment = $Comment;
49+
EnteredBy = $EnteredBy;
50+
EnteredDate = (Get-Date).ToUniversalTime();
51+
IsPrivate = $IsPrivate.ToBool();
52+
}
53+
}
54+
}
55+
56+
# Create the actual comment
57+
New-SCSMObjectProjection -Type "System.WorkItem.ServiceRequestProjection" -Projection $Projection
58+
}
59+
else
60+
{
61+
Throw "Invalid Service Request Object!"
62+
}
6363
}
Lines changed: 71 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1,84 +1,84 @@
11
function Get-SCSMIncidentRequestComment
22
{
33
<#
4-
.SYNOPSIS
5-
Function to retrieve the comments from a Incident Request WorkItem
6-
7-
.DESCRIPTION
8-
Function to retrieve the comments from a Incident Request WorkItem
9-
10-
.PARAMETER DateTime
11-
Specifies from when (DateTime) the search need to look
12-
13-
.PARAMETER GUID
14-
Specifies the GUID of the Incident Request
15-
16-
.EXAMPLE
17-
Get-SCSMServiceRequestComment -DateTime $((Get-Date).AddHours(-15))
18-
19-
.EXAMPLE
20-
Get-SCSMServiceRequestComment -DateTime "2016/01/01"
21-
22-
.EXAMPLE
23-
Get-SCSMServiceRequestComment -GUID 221dbd07-b480-ee33-fc25-6077406e83ad
24-
25-
.NOTES
26-
Francois-Xavier Cat
27-
www.LazyWinAdmin.com
28-
@lazywinadm
4+
.SYNOPSIS
5+
Function to retrieve the comments from a Incident Request WorkItem
6+
7+
.DESCRIPTION
8+
Function to retrieve the comments from a Incident Request WorkItem
9+
10+
.PARAMETER DateTime
11+
Specifies from when (DateTime) the search need to look
12+
13+
.PARAMETER GUID
14+
Specifies the GUID of the Incident Request
15+
16+
.EXAMPLE
17+
Get-SCSMServiceRequestComment -DateTime $((Get-Date).AddHours(-15))
18+
19+
.EXAMPLE
20+
Get-SCSMServiceRequestComment -DateTime "2016/01/01"
21+
22+
.EXAMPLE
23+
Get-SCSMServiceRequestComment -GUID 221dbd07-b480-ee33-fc25-6077406e83ad
24+
25+
.NOTES
26+
Francois-Xavier Cat
27+
www.LazyWinAdmin.com
28+
@lazywinadm
2929
#>
30-
31-
PARAM
32-
(
33-
[Parameter(ParameterSetName = 'General',
34-
Mandatory = $true)]
35-
$DateTime = $((Get-Date).AddHours(-24)),
36-
37-
[Parameter(ParameterSetName = 'GUID')]
38-
$GUID
39-
)
40-
BEGIN
41-
{
42-
$AssignedUserClassRelation = Get-SCSMRelationshipClass -Id 15e577a3-6bf9-6713-4eac-ba5a5b7c4722
43-
}
44-
PROCESS
45-
{
46-
47-
IF ($PSBoundParameters['GUID'])
48-
{
49-
$Tickets = Get-SCSMObject -id $GUID
50-
}
51-
ELSE
52-
{
53-
if ($DateTime -is [String]) { $DateTime = Get-Date $DateTime }
54-
$DateTime = $DateTime.ToString(yyy-MM-dd HH:mm:ss)
55-
$Tickets = Get-SCSMObject -Class (Get-SCSMClass System.WorkItem.incident$) -Filter "CreatedDate -gt '$DateTime'" #| Where-Object { $_.AssignedTo -eq $NULL }
56-
}
57-
58-
$Tickets |
59-
ForEach-Object {
60-
$CurrentTicket = $_
61-
$relatedObjects = Get-scsmrelatedobject -SMObject $CurrentTicket
62-
$AssignedTo = (Get-SCSMRelatedObject -SMObject $CurrentTicket -Relationship $AssignedUserClassRelation)
63-
Foreach ($Comment in ($relatedObjects | Where-Object { $_.classname -eq 'System.WorkItem.TroubleTicket.UserCommentLog' -or $_.classname -eq 'System.WorkItem.TroubleTicket.AnalystCommentLog' -or $_.classname -eq 'System.WorkItem.TroubleTicket.AuditCommentLog' }))
64-
{
65-
# Output the information
66-
[pscustomobject][ordered] @{
67-
TicketName = $CurrentTicket.Name
68-
TicketClassName = $CurrentTicket.Classname
69-
TicketDisplayName = $CurrentTicket.DisplayName
70-
TicketID = $CurrentTicket.ID
71-
TicketGUID = $CurrentTicket.get_id()
72-
TicketTierQueue = $CurrentTicket.TierQueue.displayname
73-
TicketAssignedTo = $AssignedTo.DisplayName
74-
TicketCreatedDate = $CurrentTicket.CreatedDate
30+
31+
PARAM
32+
(
33+
[Parameter(ParameterSetName = 'General',
34+
Mandatory = $true)]
35+
$DateTime = $((Get-Date).AddHours(-24)),
36+
37+
[Parameter(ParameterSetName = 'GUID')]
38+
$GUID
39+
)
40+
BEGIN
41+
{
42+
$AssignedUserClassRelation = Get-SCSMRelationshipClass -Id 15e577a3-6bf9-6713-4eac-ba5a5b7c4722
43+
}
44+
PROCESS
45+
{
46+
47+
IF ($PSBoundParameters['GUID'])
48+
{
49+
$Tickets = Get-SCSMObject -id $GUID
50+
}
51+
ELSE
52+
{
53+
if ($DateTime -is [String]) { $DateTime = Get-Date $DateTime }
54+
$DateTime = $DateTime.ToString(yyy-MM-dd HH:mm:ss)
55+
$Tickets = Get-SCSMObject -Class (Get-SCSMClass System.WorkItem.incident$) -Filter "CreatedDate -gt '$DateTime'" #| Where-Object { $_.AssignedTo -eq $NULL }
56+
}
57+
58+
$Tickets |
59+
ForEach-Object {
60+
$CurrentTicket = $_
61+
$relatedObjects = Get-scsmrelatedobject -SMObject $CurrentTicket
62+
$AssignedTo = (Get-SCSMRelatedObject -SMObject $CurrentTicket -Relationship $AssignedUserClassRelation)
63+
Foreach ($Comment in ($relatedObjects | Where-Object { $_.classname -eq 'System.WorkItem.TroubleTicket.UserCommentLog' -or $_.classname -eq 'System.WorkItem.TroubleTicket.AnalystCommentLog' -or $_.classname -eq 'System.WorkItem.TroubleTicket.AuditCommentLog' }))
64+
{
65+
# Output the information
66+
[pscustomobject][ordered] @{
67+
TicketName = $CurrentTicket.Name
68+
TicketClassName = $CurrentTicket.Classname
69+
TicketDisplayName = $CurrentTicket.DisplayName
70+
TicketID = $CurrentTicket.ID
71+
TicketGUID = $CurrentTicket.get_id()
72+
TicketTierQueue = $CurrentTicket.TierQueue.displayname
73+
TicketAssignedTo = $AssignedTo.DisplayName
74+
TicketCreatedDate = $CurrentTicket.CreatedDate
7575
Comment = $Comment.Comment
7676
CommentEnteredBy = $Comment.EnteredBy
7777
CommentEnteredDate = $Comment.EnteredDate
7878
CommentClassName = $Comment.ClassName
7979
}
8080
}
8181
}
82-
82+
8383
}
8484
}

0 commit comments

Comments
 (0)