Have you tested these CmdLts with 2012 SP1 release?
↧
New Post: Service Manager 2012
↧
New Post: Trying to get the parent CR of a review activity...
Try this to see if it works for you.
$SCSMServer = "localhost"
$RA = "RA12345"
$ParentRequestRelationshipID = "2da498be-0485-b2b2-d520-6ebd1698e61b"
$ReviewActivity = Get-SCSMObject -Class (Get-SCSMClass -Name System.WorkItem.Activity.ReviewActivity$ -ComputerName $SCSMServer) -ComputerName $SCSMServer -Filter "ID -eq $RA"
$RelatedParentRequest = (Get-SCSMRelationshipObject -ComputerName $SCSMServer -ByTarget $ReviewActivity | ?{$_.RelationshipID -eq $ParentRequestRelationshipID -and $_.IsDeleted -eq $False})
Ray↧
↧
New Post: How to submit a Request Offering using SMLets
Is there a way to submit a request offering using smlets? I need to use PowerShell to submit a request offering just as if a user was submitting a request offering via the service manager self-service portal. I'll be using Orchestrator running a PowerShell script that submits the request offering from data it parses from an input file.
I found a way to create a service request using smlets by using the New-SCSMOBject. But, that just creates the service request without getting the user input fields populated like they are when submitting a request offering through the self-service portal.
My goal is to create a service request but also have the user input fields populated just like they are when using the self-service portal.
Any suggestions or examples would be very helpful.
Thanks!
Jason
I found a way to create a service request using smlets by using the New-SCSMOBject. But, that just creates the service request without getting the user input fields populated like they are when submitting a request offering through the self-service portal.
My goal is to create a service request but also have the user input fields populated just like they are when using the self-service portal.
Any suggestions or examples would be very helpful.
Thanks!
Jason
↧
Created Issue: Get-SMProperty PowerShell 3 Incompatibility [10983]
When trying to run get-smproperty using Powershell 3, One will receive an error similar to the following:
```
add-member : Cannot add a member with the name "Class" because a member with that name already
exists. If you want to overwrite the member anyway, use the Force parameter to overwrite it.
At line:2 char:35
+ $class.GetProperties("recursive")|add-member -pass NoteProperty Class $class |
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (SRText1:PSObject) [Add-Member], InvalidOperation
Exception
+ FullyQualifiedErrorId : MemberAlreadyExists,Microsoft.PowerShell.Commands.AddMemberCommand
```
Repro steps:
1. Open Powershell V3
2. Import SMlets module
3. Run : get-smproperty -classname [classname guid from XML or SCSMAuthoring Tool]
Workaround:
1. Open powershell v2 (start > run > powershell -v 2)
2. Run commands as normal.
```
add-member : Cannot add a member with the name "Class" because a member with that name already
exists. If you want to overwrite the member anyway, use the Force parameter to overwrite it.
At line:2 char:35
+ $class.GetProperties("recursive")|add-member -pass NoteProperty Class $class |
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (SRText1:PSObject) [Add-Member], InvalidOperation
Exception
+ FullyQualifiedErrorId : MemberAlreadyExists,Microsoft.PowerShell.Commands.AddMemberCommand
```
Repro steps:
1. Open Powershell V3
2. Import SMlets module
3. Run : get-smproperty -classname [classname guid from XML or SCSMAuthoring Tool]
Workaround:
1. Open powershell v2 (start > run > powershell -v 2)
2. Run commands as normal.
↧
New Post: How to use the smlets from IIS7.5 on it?
Due to the post using the Google language translation, I might be English meaning can not be read.
I'm using the SCSM2012 SP1, but thought that can not be satisfied portal (SSP), to make the web portal on its own, we have the work.
Work that was done
test.ps1 that was placed in the wwwroot in does not work.
If there is any advice, please let me know.
== test.ps1 ==
echo "Conten-Type: text / html"
echo ""
echo "<html>"
echo "<head>"
echo "<title> PowerShell </ title>"
echo "</ head>"
echo "<body>"
pwd
Import-Module smlets
Get-SCSMCommand
echo "</ body>"
Output "Path ---- C: \ inetpub \ wwwroot".
The term 'Get-SCSMCommand' is not recognized as the name of the program operable cmdlet, function, or script file. Make sure that the path is correct, please try again if you make sure that the name is written correctly, the path is included. Place of occurrence C: \ inetpub \ wwwroot \ ps \ test.ps1: 10 character: 16 + Get-SCSMCommand <<<< + CategoryInfo: ObjectNotFound: (Get-SCSMCommand: String) [], CommandNotFoundException + FullyQualifiedErrorId: CommandNotFoundException
I'm using the SCSM2012 SP1, but thought that can not be satisfied portal (SSP), to make the web portal on its own, we have the work.
Work that was done
- I installed smlets SM and console to the IIS server that is different from the SCSM Management Server.
- The handler mapping of IIS "asterisk. Ps1" and register the [~ ~ \ powershell.exe-File "% s"]
- Change the service account of SCSM the IIS anonymous user
-
In the profile of the IIS server powershell I added the "Import-Module smlets".
test.ps1 that was placed in the wwwroot in does not work.
If there is any advice, please let me know.
== test.ps1 ==
echo "Conten-Type: text / html"
echo ""
echo "<html>"
echo "<head>"
echo "<title> PowerShell </ title>"
echo "</ head>"
echo "<body>"
pwd
Import-Module smlets
Get-SCSMCommand
echo "</ body>"
echo "</ html>"
↑ to work when you change to [pwd] the [Get-SCSMCommand].Output "Path ---- C: \ inetpub \ wwwroot".
it works on windows powershell, when you run this test.ps1.
Error message of Import-Module smlets of IE onImport-Module: module file for a valid module directory is not found, the module 'smlets' that was specified was not loaded. Place of occurrence C: \ inetpub \ wwwroot \ ps \ test.ps1: 9 characters: 14 + Import-Module <<<< smlets + CategoryInfo: ResourceUnavailable: (smlets: String) [Import-Module], FileNotFoundException + FullyQualifiedErrorId: Modules_ModuleNotFound, Microsoft.PowerShell.Commands.ImportModuleCommand
Error message of Get-SCSMCommand of IE onThe term 'Get-SCSMCommand' is not recognized as the name of the program operable cmdlet, function, or script file. Make sure that the path is correct, please try again if you make sure that the name is written correctly, the path is included. Place of occurrence C: \ inetpub \ wwwroot \ ps \ test.ps1: 10 character: 16 + Get-SCSMCommand <<<< + CategoryInfo: ObjectNotFound: (Get-SCSMCommand: String) [], CommandNotFoundException + FullyQualifiedErrorId: CommandNotFoundException
↧
↧
New Post: How to use the smlets from IIS7.5 on it?
I solved this problem.
I was able to run When you have changed as under the contents of test.ps1.
echo "Conten-Type: text / html"
echo ""
echo "<html>"
echo "<head>"
echo "<title> PowerShell </ title>"
echo "</ head>"
echo "<body>"
Import-Module-Name "C: \ Program Files \ Common Files \ SMLets"
Get-SCSMClass-ComputerName <My Server Name>
echo "</ body>"
echo "</ html>"
I was able to run When you have changed as under the contents of test.ps1.
echo "Conten-Type: text / html"
echo ""
echo "<html>"
echo "<head>"
echo "<title> PowerShell </ title>"
echo "</ head>"
echo "<body>"
Import-Module-Name "C: \ Program Files \ Common Files \ SMLets"
Get-SCSMClass-ComputerName <My Server Name>
echo "</ body>"
echo "</ html>"
↧
New Post: trying to email users if more than one manual activity has been completed for an incident.
Hello - Currently when Service Manager has related items such as a manual activity the subscriptions I created can basically reply back whenever the first manual activity has been completed. If another one which is in progress in that same incident has been completed it will not send a notification out. So I decided to see if I could create something using Powershell but am stuck. Here is what I have so far but am not sure I have all the variables needed to actually do anything. What i'd like to do is setup a schedule task that runs every 5 minutes and that the script goes through and checks to see if any manual activitys have been completed in the last 5 minutes and it send out an e-mail to the incident assigned to user. Your assistance would greatly be appreciated.
Import-Module smlets
$UserClass = Get-SCSMCLass -Name Microsoft.Ad.User$
$User = Get-SCSMObject -Class $UserClass -Filter "DisplayName -eq $Implementer"
$ImplementerRelationship = Get-SCSMRelationshipClass -Name System.WorkItemAssignedtouser$
$Workitemcontainsactivity = Get-SCSMRelationShipClass -Name System.Workitemcontainsactivity
$Completed = Get-SCSMEnumeration -Name ActivityStatusEnum.Completed
Import-Module smlets
Variables
$Activity = Get-SCSMObject -Class(Get-SCSMClass -Name System.workitem.activity.manualactivity$)|Where{$_Status.Displayname -like "In Progess"}$UserClass = Get-SCSMCLass -Name Microsoft.Ad.User$
$User = Get-SCSMObject -Class $UserClass -Filter "DisplayName -eq $Implementer"
$ImplementerRelationship = Get-SCSMRelationshipClass -Name System.WorkItemAssignedtouser$
$Workitemcontainsactivity = Get-SCSMRelationShipClass -Name System.Workitemcontainsactivity
$Completed = Get-SCSMEnumeration -Name ActivityStatusEnum.Completed
↧
New Post: Trying to get the parent CR of a review activity...
Hi Ray - Is the parentrequestrelationshipID something specific to your setup?
↧
New Post: Trying to get the parent CR of a review activity...
No, this should be the same in your environment as its the same in my 3 environments and they are separate installs, not clones.
Also, if you have nested a activity this wont work since it will return the parent which maybe a Parallel Activity or something else. I have a new script block which will hunt up the parents until it gets to the SR or CR. I'll post it on Monday.
Ray
Also, if you have nested a activity this wont work since it will return the parent which maybe a Parallel Activity or something else. I have a new script block which will hunt up the parents until it gets to the SR or CR. I'll post it on Monday.
Ray
↧
↧
New Post: Can I schedule Remove-SCSMObject -Force?
I would like to schedule every mounth Remove-SCSMObject for remove all Incidents that have priority 6,8,9.
This is possible with the cmdlet bilow:
$irClass = Get-SCSMClass -Name System.WorkItem.Incident$
Get-SCSMObject -Class $irClass | Where {$_.Priority -ne 8 -and $_.Priority -ne 9 -and $_.Priority -ne 6 -and $_.FirstAssignedDate -eq $null} | Remove-SCSMObject -Force
I'm wondering what the impact of schedule deleting this behavior. Anybody out there using Remove-SCSMObject cmdlet in this way right now?
This is possible with the cmdlet bilow:
$irClass = Get-SCSMClass -Name System.WorkItem.Incident$
Get-SCSMObject -Class $irClass | Where {$_.Priority -ne 8 -and $_.Priority -ne 9 -and $_.Priority -ne 6 -and $_.FirstAssignedDate -eq $null} | Remove-SCSMObject -Force
I'm wondering what the impact of schedule deleting this behavior. Anybody out there using Remove-SCSMObject cmdlet in this way right now?
↧
New Post: Trying to get the parent CR of a review activity...
This is a block of code I use since I have many activities nested in parallel activities and I want to make sure the parent is actually the SR or CR.
$SCSMServer = "localhost"
$RA = "RA12345"
$ParentRequestRelationshipID = "2da498be-0485-b2b2-d520-6ebd1698e61b"
$ReviewActivity = Get-SCSMObject -Class (Get-SCSMClass -Name System.WorkItem.Activity.ReviewActivity$ -ComputerName $SCSMServer) -ComputerName $SCSMServer -Filter "ID -eq $RA"
$RelatedParentRequest = (Get-SCSMRelationshipObject -ComputerName $SCSMServer -ByTarget $ReviewActivity | ?{$_.RelationshipID -eq $ParentRequestRelationshipID -and $_.IsDeleted -eq $False})
# Check to see if the parent is the SR or CR
If (-not($RelatedParentRequest.SourceObject.Name -like "CR*" -or $RelatedParentRequest.SourceObject.Name -like "SR*"))
{
DO {
$ParentActivity = Get-SCSMObject -Id $RelatedParentRequest.SourceObject.Id -ComputerName $SCSMServer
$RelatedParentRequest = (Get-SCSMRelationshipObject -ComputerName $SCSMServer -ByTarget $ParentActivity | ?{$_.RelationshipID -eq $ParentRequestRelationshipID -and $_.IsDeleted -eq $False})
$count += 1
} Until ($RelatedParentRequest.SourceObject.Name -like "CR*" -or $RelatedParentRequest.SourceObject.Name -like "SR*" -or $count -ige 10)
}
↧
New Post: Get Affected Item
I am going to apologize up front I am a complete noob when it comes to SM and especially SMLets.
Can someone assist me in getting the affected item (in this case a single computer) out of a single incident?
TIA!!!
Can someone assist me in getting the affected item (in this case a single computer) out of a single incident?
TIA!!!
↧
New Post: Update the location of Build.ps1 in ReadMe.txt
The ReadMe.txt in SCSM PowerShell Cmdlets BETA 4 stated that the "Build.ps1" is in the current directory (which by default is C:\Program Files\Common Files\SMLets). However, the actual location of "Build.ps1" should be under the "C:\Program Files\Common Files\SMLets\Src" sub-directory instead.
↧
↧
New Post: How to submit a Request Offering using SMLets
This is to Rob Hydell who was asking if I ever found a resolution. I found this blog a while back which got me started:
http://www.leealanberg.com/blog/2013/01/08/using-smlets-powershell-to-create-a-scsm-2012-service-request-with-template/
I expanded on that and now my Powershll that's running in the runbook is working great.
http://www.leealanberg.com/blog/2013/01/08/using-smlets-powershell-to-create-a-scsm-2012-service-request-with-template/
I expanded on that and now my Powershll that's running in the runbook is working great.
↧
New Post: List all "Service Requests" (children) of a (parent) "Service Offering" or "Request Offering"
I am sure this is a stupid question with a simple answer but....
I can list ALL "Service Requests" but how do I only show those service requests that are part of a certain Service Offering or Request Offering (either)
[Example]
Get-SCSMObject -Class (Get-SCSMClass -Name System.WorkItem.ServiceRequest$) -Filter "ParentServiceOfferingGUID -eq 137f7673-8486-9260-8265-a808b99b7c8a" | Format-Table ID, Status
<returns only those service requests belonging to ServiceOffering (or Request Offering) with the GUID above>
Id Status
SR1410 Canceled
SR2592 Completed
SR2609 Completed
Thanks in advance to anyone who can help.
I can list ALL "Service Requests" but how do I only show those service requests that are part of a certain Service Offering or Request Offering (either)
[Example]
Get-SCSMObject -Class (Get-SCSMClass -Name System.WorkItem.ServiceRequest$) -Filter "ParentServiceOfferingGUID -eq 137f7673-8486-9260-8265-a808b99b7c8a" | Format-Table ID, Status
<returns only those service requests belonging to ServiceOffering (or Request Offering) with the GUID above>
Id Status
SR1410 Canceled
SR2592 Completed
SR2609 Completed
Thanks in advance to anyone who can help.
↧
New Post: How to submit a Request Offering using SMLets
Thanks Jason for the quick response !
↧
New Post: List all "Service Requests" (children) of a (parent) "Service Offering" or "Request Offering"
I was actually able to answer this myself. Hopefully someone will find this useful.
$RequestOffering = (Get-SCSMObject -Class (Get-SCSMClass -Name System.RequestOffering$) -Filter "DisplayName -eq My Test Request Offering)")
$ServiceRequests = (Get-SCSMRelationshipObject -ByTarget $RequestOffering | ?{$_.RelationshipID -eq "2730587F-3D88-A4E4-42D8-08CF94535A6E"}).SourceObject
$ServiceRequests
They key elements are in bold. To get the relationship ID run the following where SR56346 is one of your service requests:
$ServiceRequest = Get-SCSMObject -Class (Get-SCSMClass -Name System.WorkItem.ServiceRequest$) -Filter "ID -eq SR56346"
Get-SCSMRelationshipObject -BySource $ServiceRequest
[OUTPUT WILL LOOK LIKE THIS] - Find the one with the source as your service request as the SOURCE and your Request Offering as the Target. The RelationshipID is the GUID you are looking for.
SourceObject : SR56346 - My Test Service Request
TargetObject : My Test Request Offering
RelationshipId : 2730587f-3d88-a4e4-42d8-08cf94535a6e
IsDeleted : False
Values : {}
LastModified : 7/10/2013 9:05:46 PM
IsNew : False
HasChanges : False
Id : df58b383-10a6-80ef-5e85-e1907d60d839
ManagementGroup : MyManagementGroup
ManagementGroupId : d9845f09-a477-ede8-c9ec-abe62114ccf9
Here are some others as examples
$RequestOffering = (Get-SCSMRelationshipObject -BySource $ServiceRequest | ?{$_.RelationshipID -eq "2730587F-3D88-A4E4-42D8-08CF94535A6E"}).TargetObject
$RequestOffering.Get_ID()
$RequestOffering = (Get-SCSMRelationshipObject -BySource $ServiceOffering | ?{$_.RelationshipID -eq "be417a55-6622-0fc3-fcea-90cd23e0fc23"}).TargetObject
$RequestOffering
$ServiceRequests = (Get-SCSMRelationshipObject -ByTarget $RequestOffering | ?{$_.RelationshipID -eq "2730587F-3D88-A4E4-42D8-08CF94535A6E"}).SourceObject
$ServiceRequests
$RequestOffering = (Get-SCSMObject -Class (Get-SCSMClass -Name System.RequestOffering$) -Filter "DisplayName -eq My Test Request Offering)")
$ServiceRequests = (Get-SCSMRelationshipObject -ByTarget $RequestOffering | ?{$_.RelationshipID -eq "2730587F-3D88-A4E4-42D8-08CF94535A6E"}).SourceObject
$ServiceRequests
They key elements are in bold. To get the relationship ID run the following where SR56346 is one of your service requests:
$ServiceRequest = Get-SCSMObject -Class (Get-SCSMClass -Name System.WorkItem.ServiceRequest$) -Filter "ID -eq SR56346"
Get-SCSMRelationshipObject -BySource $ServiceRequest
[OUTPUT WILL LOOK LIKE THIS] - Find the one with the source as your service request as the SOURCE and your Request Offering as the Target. The RelationshipID is the GUID you are looking for.
SourceObject : SR56346 - My Test Service Request
TargetObject : My Test Request Offering
RelationshipId : 2730587f-3d88-a4e4-42d8-08cf94535a6e
IsDeleted : False
Values : {}
LastModified : 7/10/2013 9:05:46 PM
IsNew : False
HasChanges : False
Id : df58b383-10a6-80ef-5e85-e1907d60d839
ManagementGroup : MyManagementGroup
ManagementGroupId : d9845f09-a477-ede8-c9ec-abe62114ccf9
Here are some others as examples
RELATIONSHIPS
RELATIONSHIP: Service Request to Request Offering
$ServiceRequest = Get-SCSMObject -Class (Get-SCSMClass -Name System.WorkItem.ServiceRequest$) -Filter "ID -eq SR56346"$RequestOffering = (Get-SCSMRelationshipObject -BySource $ServiceRequest | ?{$_.RelationshipID -eq "2730587F-3D88-A4E4-42D8-08CF94535A6E"}).TargetObject
$RequestOffering.Get_ID()
RELATIONSHIP: Service Offering To Request Offering
$ServiceOffering = Get-SCSMObject -Class (Get-SCSMClass -Name System.ServiceOffering$) -Filter "DisplayName -eq My Test Service Offering"$RequestOffering = (Get-SCSMRelationshipObject -BySource $ServiceOffering | ?{$_.RelationshipID -eq "be417a55-6622-0fc3-fcea-90cd23e0fc23"}).TargetObject
$RequestOffering
RELATIONSHIP: Request Offering to Service Requests (the one above)
$RequestOffering = (Get-SCSMObject -Class (Get-SCSMClass -Name System.RequestOffering$) -Filter "DisplayName -eq My Test Request Offering")$ServiceRequests = (Get-SCSMRelationshipObject -ByTarget $RequestOffering | ?{$_.RelationshipID -eq "2730587F-3D88-A4E4-42D8-08CF94535A6E"}).SourceObject
$ServiceRequests
↧
↧
Edited Issue: Set-SCSMobject unable to set datetime field [8810]
Hi,
I wanted to set a dateTime value into the TargetResolutionTime of an incident. This fails always with an error message (see below).
I use the SMLets Beta 3 and SCSM2010 SP1 CU2.
Since I'm able to update other fields and I'm sure I used a dateTime value, I guess it is a bug in the SMLets.
But may be I'm wrong. In that case please let me know.
BTW: I also used (Get-Date) to set the dateTime value.
Thanks for your help
Oliver
--- snip ---
PS D:\SCSMscripts> Get-SCSMObject -Class (Get-SCSMClass System.WorkItem.Incident$) -Filter "ID -eq IR164" | Set-SCSMObject -debug -PropertyHashtable @{ TargetResolutionTime = [datetime]::now }
DEBUG: Attempting to find property TargetResolutionTime
Confirm
Continue with this operation?
[Y] Yes [A] Yes to All [H] Halt Command [S] Suspend [?] Help (default is "Y"):
DEBUG: PROPERTY TargetResolutionTime == TargetResolutionTime Result: 0
Confirm
Continue with this operation?
[Y] Yes [A] Yes to All [H] Halt Command [S] Suspend [?] Help (default is "Y"):
DEBUG: Assigning 17/06/2011 12:32:36 to TargetResolutionTime
Confirm
Continue with this operation?
[Y] Yes [A] Yes to All [H] Halt Command [S] Suspend [?] Help (default is "Y"):
VERBOSE: Want to set TargetResolutionTime(datetime) to 17/06/2011 12:32:36
Confirm
Continue with this operation?
[Y] Yes [A] Yes to All [H] Halt Command [S] Suspend [?] Help (default is "Y"):
Confirm
Simple object value was not the proper type.
[Y] Yes [A] Yes to All [H] Halt Command [S] Suspend [?] Help (default is "Y"):
Set-SCSMObject : Simple object value was not the proper type.
At line:1 char:104
+ Get-SCSMObject -Class (Get-SCSMClass System.WorkItem.Incident$) -Filter "ID -eq IR164" | Set-SCSMObject <<<< -debug
-PropertyHashtable @{ TargetResolutionTime = [datetime]::now }
+ CategoryInfo : ObjectNotFound: (17/06/2011 12:32:36:DateTime) [Set-SCSMObject], InvalidSimpleObjectValu
eException
+ FullyQualifiedErrorId : Could not assign date ,SMLets.SetSMObjectCommand
VERBOSE: Adding 9d0b4646-5f78-0988-e59d-7093509cb7b6 to change list
Confirm
Continue with this operation?
[Y] Yes [A] Yes to All [H] Halt Command [S] Suspend [?] Help (default is "Y"):
Confirm
Are you sure you want to perform this action?
Performing operation "Set-SCSMObject" on Target "SMObjects".
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"):
PS D:\SCSMscripts>
--- snap ---
I wanted to set a dateTime value into the TargetResolutionTime of an incident. This fails always with an error message (see below).
I use the SMLets Beta 3 and SCSM2010 SP1 CU2.
Since I'm able to update other fields and I'm sure I used a dateTime value, I guess it is a bug in the SMLets.
But may be I'm wrong. In that case please let me know.
BTW: I also used (Get-Date) to set the dateTime value.
Thanks for your help
Oliver
--- snip ---
PS D:\SCSMscripts> Get-SCSMObject -Class (Get-SCSMClass System.WorkItem.Incident$) -Filter "ID -eq IR164" | Set-SCSMObject -debug -PropertyHashtable @{ TargetResolutionTime = [datetime]::now }
DEBUG: Attempting to find property TargetResolutionTime
Confirm
Continue with this operation?
[Y] Yes [A] Yes to All [H] Halt Command [S] Suspend [?] Help (default is "Y"):
DEBUG: PROPERTY TargetResolutionTime == TargetResolutionTime Result: 0
Confirm
Continue with this operation?
[Y] Yes [A] Yes to All [H] Halt Command [S] Suspend [?] Help (default is "Y"):
DEBUG: Assigning 17/06/2011 12:32:36 to TargetResolutionTime
Confirm
Continue with this operation?
[Y] Yes [A] Yes to All [H] Halt Command [S] Suspend [?] Help (default is "Y"):
VERBOSE: Want to set TargetResolutionTime(datetime) to 17/06/2011 12:32:36
Confirm
Continue with this operation?
[Y] Yes [A] Yes to All [H] Halt Command [S] Suspend [?] Help (default is "Y"):
Confirm
Simple object value was not the proper type.
[Y] Yes [A] Yes to All [H] Halt Command [S] Suspend [?] Help (default is "Y"):
Set-SCSMObject : Simple object value was not the proper type.
At line:1 char:104
+ Get-SCSMObject -Class (Get-SCSMClass System.WorkItem.Incident$) -Filter "ID -eq IR164" | Set-SCSMObject <<<< -debug
-PropertyHashtable @{ TargetResolutionTime = [datetime]::now }
+ CategoryInfo : ObjectNotFound: (17/06/2011 12:32:36:DateTime) [Set-SCSMObject], InvalidSimpleObjectValu
eException
+ FullyQualifiedErrorId : Could not assign date ,SMLets.SetSMObjectCommand
VERBOSE: Adding 9d0b4646-5f78-0988-e59d-7093509cb7b6 to change list
Confirm
Continue with this operation?
[Y] Yes [A] Yes to All [H] Halt Command [S] Suspend [?] Help (default is "Y"):
Confirm
Are you sure you want to perform this action?
Performing operation "Set-SCSMObject" on Target "SMObjects".
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"):
PS D:\SCSMscripts>
--- snap ---
↧
New Post: Changing an incidents title through PowerShell
I'm working on a script to create and resolve incident quickly, creating and resolving incidents can be a slow process on older systems.
I still need to figure out how to chance an incidents Title, to contain the incidents ID.
Is there a shell for that?
My Shell skills are farely limited.
This is what i god so far, it will create an Incident, then assign it to me
I still need to figure out how to chance an incidents Title, to contain the incidents ID.
Is there a shell for that?
My Shell skills are farely limited.
This is what i god so far, it will create an Incident, then assign it to me
Import-Module SMlets
###Create Quick Incident
$AffectedUser = Read-host -Prompt 'Affected Users initials'
$Title = Read-host -Prompt 'Short Title'
$Description = 'Quick incident, no description neccesary'
New-SCSMincident -impact low -Urgency Medium -Title QuickXYZ-$Title -Description $Description -Classification Quick -affecteduser Esbjerg\$AffectedUser
###Assign user to Incident
$Username = "AdmReH"
$Domain = "Esbjerg"
$I = get-SCSMObject (Get-SCSMClass System.WorkItem.Incident$) -filter "Title -eq QuickXYZ-$Title"
$U = Get-SCSMObject (Get-SCSMClass System.Domain.User$) | ?{$_.Domain -eq $domain -and $_.Username -eq $username}
$R = Get-SCSMRelationshipClass System.WorkItemAssignedToUser$
$N = New-SCSMRelationshipObject -Relationship $R -Source $I -Target $U -NoCommit
$N.Commit()
Remove-Module SMLets
↧
Created Unassigned: All Unassigned Service Requests script needed [11252]
Hello, I would like to write a script to pull all the unassigned service requests that were created 12hrs prior to current date. I need to be able to filter on specific support groups. It appears easier to do this for incidents but because there is no get-scsmservicerequest cmdlet, I am at a loss. Thanks
↧