There is an 'ID' property which is misleading, it contains the number of the request, for example IR123456.
And for some other type of objects, such as the DomainUser or Enumeration objects the GUID is the..... ID property.
Note: I'm using the module SMlets, available here: https://smlets.codeplex.com/
Getting the GUID for a WorkItem
If you look at the property of an Incident for example, you will notice that there is no property that contains the GUID
You will have to use the method get_id() to retrieve this information
Incident RequestYou will have to use the method get_id() to retrieve this information
# Get a specific Incident Request $IncidentRequest = Get-SCSMObject -Class (Get-SCSMClass -Name System.WorkItem.Incident$) -filter "ID -eq IR31437" # Getting the GUID of this Work Item $IncidentRequest.get_id()
Service Request
# Get a specific Service Request $ServiceRequest = Get-SCSMObject -Class (Get-SCSMClass -Name System.WorkItem.ServiceRequest$) -filter "ID -eq SR31467" # Getting the GUID of this Work Item $ServiceRequest.get_id()
Review Activity
# Get a specific review activity $ReviewActivity = Get-SCSMObject -Class (Get-SCSMClass -Name System.WorkItem.Activity.ReviewActivity$) -filter "ID -eq RA31724" # Get the GUID of this Work Item $ReviewActivity.get_id()
ManualActivity
# Get a specific manual activity $ManualActivity = Get-SCSMObject -Class (Get-SCSMClass -Name System.WorkItem.Activity.ManualActivity$) -filter "ID -eq MA45345" # Get the GUID of this Work Item $ManualActivity.get_id()
Runbook Activity
# Get a Runbook Activity $RunbookActivity = Get-SCSMObject -Class (Get-SCSMClass -Name Microsoft.SystemCenter.Orchestrator.RunbookAutomationActivity$) -filter 'ID -eq RB30579' # Retrieve the ID property $RunbookActivity.id # Retrieve the GUID $RunbookActivity.get_id()
Getting the GUID for other objects
Domain User
# Query a Domain User from the CMDB $DomainUser = Get-SCSMObject -Class (Get-SCSMClass -Name Microsoft.AD.User$) -Filter "LastName -eq Cat" # Get the GUID of this CI $DomainUser.id
Domain Computer
# Get a computer object from the CMDB $ComputerObject = Get-SCSMObject -Class (Get-SCSMClass -Name Microsoft.Windows.Computer$) -Filter "Displayname -eq MTLLAP8500" # Retrieve the ID $ComputerObject.id # Retrieve the ID using the Get_ID() method. $ComputerObject.get_id()
Thanks for reading! If you have any questions, leave a comment or send me an email at fxcat@lazywinadmin.com. I invite you to follow me on Twitter @lazywinadm / Google+ / LinkedIn. You can also follow the LazyWinAdmin Blog on Facebook Page and Google+ Page.
I have visited the site carefully. and read its posts thank you so much for sharing this kind of information. I am sharing a site of msds.It is free printable msds sheets online
ReplyDeleteHi Francois-Xavier
ReplyDeleteI am not sure if I am being silly or not. I have downloaded the function and have tried to execute it. When I try to add the subnet I get an error: The term 'Add-Subnet' is not recognized.
Please advise if I am doing something wrong or missing out on something.
Hey Dhillan!
ReplyDeleteYou need to load the function in your session first.
You can do the following:
. c:\scripts\add-adsubnet.ps1
Notice the dot and space at the beginning of the line. This technique is called Dot Sourcing.
Once this is done you will be able to use the Add-ADSubnet function.
Hope this help
Hey
ReplyDeleteThanks for replying. I did get it work after all ... I found that the DASHES in the script name was a problem when I changed this to underscores they worked fine.
Excellent script really saves me time :) Thanks
Awesome :-) Good to hear that
ReplyDeleteThanks for the feedback
Hi.
ReplyDeletenot works with me. i don´t know how to.. :(
Hey Claudio, which one did you try ? ADSI or ActiveDirectory module ?
ReplyDeleteCould you provide some more information ? what is the error message.