Adding a Relationship to a Group of a Imported Management Pack using PowerShell
I want to add a relationship to a existing group in SCOM so that more types of object can be added to the group. How to do this? I've managed to do this but don't know how to specify the "containment" relation in powershell. Please advise. Thanks!
P.S. The to be answered line is "$relationshipClass.Base = ???"
$ManagementServer = "localhost"
$ManagementPackID = "TestNewVerTemplate"
$ReName = "Test_22"
Add-PSSnapin Microsoft.EnterpriseManagement.OperationsManager.Client
$MG = New-Object Microsoft.EnterpriseManagement.ManagementGroup($ManagementServer)
$MP = $MG.GetManagementPacks($ManagementPackID)[0]
$relationshipClass = New-OBject Microsoft.EnterpriseManagement.Configuration.ManagementPackRelationship($MP, $ReName, [Microsoft.EnterpriseManagement.Configuration.ManagementPackAccessibility]::Internal);
$sourceClass = Get-SCOMClass -Name "GroupPopulation.TestNewVerTemplateGroup"
$targetClass = Get-SCOMClass -NAme "Microsoft.Windows.Computer"
$relationshipClass.Abstract = $false;
$relationshipClass.Base = ???
# There is some existing relationship in the group. If it is used, then the script works.
# $relationshipClass.Base = $MP.GetRelationships()[0].Base;
$relationshipClass.DisplayName = "sample relationship";
$relationshipClass.Description = "sample relationship";
$source = new-object Microsoft.EnterpriseManagement.Configuration.ManagementPackRelationshipEndpoint($relationshipClass, "Source");
$source.Type = [Microsoft.EnterpriseManagement.Configuration.ManagementPackElementReference`1[Microsoft.EnterpriseManagement.Configuration.ManagementPackClass]]::op_implicit($sourceCLass);
#$source.Type = $MP.GetRelationships()[0].Source.Type;
$relationshipClass.Source = $source;
$target = new-object Microsoft.EnterpriseManagement.Configuration.ManagementPackRelationshipEndpoint($relationshipClass, "Target");
$target.Type = [Microsoft.EnterpriseManagement.Configuration.ManagementPackElementReference`1[Microsoft.EnterpriseManagement.Configuration.ManagementPackClass]]::op_implicit($targetClass);
#$target.Type = $MP.GetRelationships()[1].Target.Type;
$relationshipClass.Target = $target;
$mp.Verify();
$mp.AcceptChanges();
Amdishigh,
Please check if any of the following articles (I have 2 depending on your opsmgr version) apply to your environment.
for SCOM 2007:
http://msdn.microsoft.com/en-us/library/bb437513.aspx
for SCOM 2012:
http://msdn.microsoft.com/en-us/library/hh328983.aspx
hth,
Jose
Similar Messages
-
How can I find what scom group a specific server belongs to using powershell?
Environment: SCOM 2007 r2
Server in question: Running Windows 2003 Std. (yes I know this sounds crazy)
Why do I need this: I noticed at the console level we have had server unexpected shutdown events which are not generating email notifications.
Source shows: Windows 2003 Server Standard Edition
Alert Rule: Windows Shutdown Unexpectedly
From what I see these are all windows 2003 server Std edition systems. I did a track and trace using our exchange tracking system which confirmed the alerts were not being emailed. Not sure if there is a better approach for this, but not being a sql
expert (however I do have someone I can leverage) I am trying to see if I can somehow extract this information using powershell.
Secondary general question: How can I find out the current size of our scom 2007 database and the number of objkects\servers being monitored? This is prep work for a migration over to 2012.
Thanks in advance for the help!1. what scom group a specific server belongs to
function Get-GroupNames {
[cmdletbinding()]
param($computerFQDN)
$containmentRel = Get-RelationshipClass -name:’Microsoft.SystemCenter.InstanceGroupContainsEntities’
$computerClass = Get-MonitoringClass -name:”Microsoft.Windows.Computer”
$criteria = [string]::Format(“PrincipalName = ‘{0}’”,$computerFQDN)
try {
$computer = Get-MonitoringObject -monitoringClass:$computerClass -criteria:$criteria
$relatedObjects = $computer.GetMonitoringRelationshipObjectsWhereTarget($containmentRel,[Microsoft.EnterpriseManagement.Configuration.DerivedClassTraversalDepth]::Recursive,[Microsoft.EnterpriseManagement.Common.TraversalDepth]::Recursive)
catch {
$_
write-host “An error occurred while querying groups of $computerFQDN”
foreach($group in $relatedObjects)
[array]$Groups = $groups + $group.SourceMonitoringObject.DisplayName
if($groups) {
return $groups
} else {
write-host “No groups available for $computerFQDN”
Usage:
Get-GroupName -ComputerFQDN myserver1
for detail, pls. refer to
http://techibee.com/powershell/powershell-get-scom-groups-of-a-computer-account/1129
Roger -
Register Relationships and Device Grouping
Hi All,
Can anyone provide me some documentation on Register Relationships and Device Grouping in IS-Device Management and the respective use of the same.
Use means I mean: on which business cases we are going for register relationships and device grouping and the needed configuration needed to be done.Hi Niladri,
Please go through the below link
http://help.sap.com/saphelp_rc10/helpdata/en/9c/862f9c10df11d285250000e8200ef0/frameset.htm
If you still face any problem do let us know.
Regards,
S -
Relationship import | Import manager
Hi ,
I am trying to import relationships through import manager in the material repository . What I do is , there are some existing relationships that I created in the data manager . I export them first [ data manager > relationships > export to a file ] to a file and then make changes to the existing file . I use the same file to import relationships but this time with the import manager . I have the following column names in my ".TXT" file ...
1) material numbe <name of the relationship defined in the console>
2) material number <>
3) quantity
I can successfully map the fields and then when I choose the import action it gives me the following error ...
Import failed. Field not found.
Import action: NoneSource record no: 8
there is no record in my file actually at number 8 . I removed the last "Enter" from the file and then imported it but with same results . I exported the existing relationships to an excel file and then tried to import it through the import manager but with the same result .
To verify if there is a problem with the file I use the same file to import the relationships through data manager [relationships > import from file > name of the relationship defined in the console ] and I am able to successfully import it .
What do you guys think is the problem ??
Regards
Deepak SinghHi Deepak,
I had performed the following steps and it worked perfectly fine.
Just go through them once and check that you have did the same.
1. Export Relationship using Data Manager -> Relationships -> Export to File.[There is only Display Field i.e. Material]
2. Imported the same text file with Type="Delimited Text" and Delimiter="\t"
3. Select the Relationship table from the Destination drop down list.
4. Map the Parent Material with the Material[Parent] and Child with Material[Child].Also Quantity with the qualifier Quantity.
5. Execute the import.
Note : Please dont make any changes to the Text file and try importing.
Regards,
Jitesh Talreja
Edited by: Jitesh Talreja on Apr 10, 2008 7:25 AM -
Create multiple management packs and groups
Hi,
I wonder if it is a way to create a lots of Groups and management packs automatically/scripted.
My problem is that I have a list with about 200 services that I need to setup monitoring for.
The monitoring are simple, its just if the service are started or stopped.
I need to have one management pack and one group for each service.
Like this:
The monitor monitors the service "workstation" if its started or stopped.
The monitor needs to be created in a management pack with this name: "Custom-Service-workstation"
The agents that I want to monitor this on need to be members of the group "Group-Custom-Service-workstation"
Please, please help me with this.You may refer to the following blog for
Create Management pack with powershell:http://blogs.msdn.com/b/rslaten/archive/2013/05/09/creating-management-packs-in-scom-2012-with-powershell.aspx
Create group with powershell:
http://blogs.msdn.com/b/rslaten/archive/2013/06/06/creating-groups-in-scom-2012-with-powershell.aspx
Roger -
Hi there,
I am working through my first complex Distributed Application which I have been creating using VSAE. I have followed Brian Wren's training, but the result does not match what I am expecting.
I have created a single DA (based on the System.Service class) with four groups (base on System.Group) which will be populated with the core components of the application. Each of the groups (and the DA) is configured as a Public, Non-Abstract, Non-Hosted
Singleton, as per the MPAuthor.Stores example. Each of the four groups is linked via an Internal, Non-Abstract System.Containment relationship to the DA.
When I open the DA diagram view, I only get the DA class visible. Each of the four groups shows in the Groups node in the Operations Console. Based on the experience with importing the MPAuthor.Stores MP, I was not expecting to see the groups in the Groups
node, but linked in the DA diagram node.
I have configured dependency monitors for each of the groups, and these display in the Health Explorer but there is no health rolls up.
The only difference between the MPAuthor.Stores module and mine (that I am aware of) is MPAuthors.Stores is a 2007 R2 MP, and I have created a 2012 MP as I will be deploying to 2012 SP1 and there is no need for backwards compatibility.Hi Vladimir,
Thanks again for your response. I'm not quite sure what you mean with your last post. My current DA model is:
| Dist App |
| System.Service |
|
| | | |
| Group 1 | | Group 2 | | Group 3 | | Group 4 |
| System.Group | | System.Group | | System.Group | | System.Group |
Where all the groups have discoveries for membership. Are you saying that I need another level of groups below these to house the objects?
I thought that the point of System.Group as a base class was that it did not appear in the console, but gave an automatic health rollup (as per TechNet). Interestingly I am not getting
the automated health rollup for the Groups for their members and it is displaying in the Groups list in the console.
I have also tried creating a new DA with a single group in an 07 MP, and have the same issue. The sample MPAuthor.Stores management pack works as expected. -
Organization Model : Adding new relationships
Hi friends,
<b> Organization Model : Adding new relationships to the existing list while assigning agents to a position </b>
Using transaction PPOMW, after creating an organization unit we assign a position to it.
When we right click the Position and select assign from the context menu, a dialog box appears where we have to choose relationships.
Can we create and add new relationships to this list. say for e.g. Position: holder Site
Please help.
JonJon,
This is definitely possible. I had a similar reqt where a new relationship Position: Holder Location was required.
Here's how to go about it.
1. We have to maintain the required entry in the table T77AR
This can be done through Transaction Code: SM30 or OOVK
Enter the table name T77AR and click Maintain button
2. Select Relationship 008: Holder from the table
Double Click on Relationship Characteristics from the frame on the Left Hand side. Here two entries are maintained.
The details of each of the above columns are given below.
A/B: Contains a code that represents a particular type of a relationship. there are two types, active(A) and passive(B) (reciprocal).
The two types exist since most relationships have two corresponding sides, or perspectives. For example, consider the relationship between a father and son. There is only one relationship, but there are two distinct perspectives to that relationship.
NOTE: Active and passive should not be assumed to mean superior and subordinate. Sometimes one side of a relationship does have a superior standing. However, it is also possible that both sides of a relationship have equal, and corresponding, standing. It is also possible that some relationships will be one-sided. This occurs when, for example, you create relationships with external objects.
Relationship: Contains a code that represents the relationship between two objects.
100% Check: You can specify in this field whether the 100% limit should be checked when percentages are entered for weighted relationships (infotype 1001).
The value entered in this field will determine the type of message that is issued if the 100% limit is exceeded when a relationship is created.
You can choose between the following values:
'E' = error
'I' = information
'W' = warning
' ' = no check is carried out
Check Work Schedule: You can use this field to control how the system is to treat relationships to persons in connection with the infotype "Work Schedule" (1011).
Check obsolete: This field controls the system reaction when relationships are entered or changed in connection with the infotype "Obsolete - 1014".
3. Now double click on the Allowed Relationships button from the frame on the left hand side.
Here we maintain a new entry Site.
Object: S
Object type text: Position
A/B: A
Rel: 008
Relationship Name: Holder
RelObjType: F (Site)
4. This entry now appears in the dialog box
<b> R&D is the name of the game </b>
Julius -
Hi
I am currently adding a chart for each group on group footer in a table.
but i want that charts to be on the right side of the group data.
regards
Pratap M:)Hi PratapM,
If I understand correctly, you have already added a chart in group footer, and you want to display the chart on the right side of the cell. If I have misunderstood, please don't hesitate to let me know.
Based on my research, if we directly add a chart into a cell, the chart will fill all of the space in the cell. So in order to achieve your requirement, we can insert this chart into a rectangle, then add the rectangle to the group footer. If we want to
display the chart on the right side, we can directly drag the chat to the right of the rectangle.
If there are any misunderstanding, please elaborate the issue for further investigation.
Thanks,
Katherine Xiong
Katherine Xiong
TechNet Community Support -
Hello,
I want to assign certain network users the ability to login via browser to the profile manager for 10.8.x server and add/remove other users from user groups. Think teachers managing their class rosters, if the class was a group and the users their students. I do not want any other admin funtionality beyond that for them.
Suggestions?Well thank you for being so polite. Yes, on looking on my 10.8 server, I have the same thing. How annoying. I have no idea how to answer your question. If the management abilities are no longer in Workgroup Manager then there's a change that the server doesn't pay any attention to the settings, so manually changing settings in LDAP won't have any effect either.
At least I can verify that it's not just you who gets that result. I wonder what happened and how we're meant to do this now. -
not able to set security group without mail enabled as site collection admin using powershell in sharepoint online site - office 365?
Any idea?after few days test in my lab, I can see that only email enabled group can be added as site collection admin using POWERSHELL.
hope this helps who stuck like me!! :-) -
How to add new group entry in Cisco Vpn using powershell
I am working on a powershell script to connect cisco vpn using powershell, I am able to connect to vpn but not sure how to add new group to vpn. I am using the following script$vpn_profile = 'Test'
$username = 'TestUser'
$userPassword = ConvertTo-SecureString -String "Password" -AsPlainText -Force
$credentials = new-object -typename System.Management.Automation.PSCredential -argumentlist
$username,$userPassword
$password = $credentials.GetNetworkCredential().Password
Set-Location 'c:\Program Files (x86)\Cisco Systems\VPN Client'
.\vpnclient.exe connect $vpn_profile user $username pwd $password
Write-Host "You Are Connected"
cd "C:\"Have you entered .\vpnclient.exe /? to see if it will return information about other switches you can use with this executable? Other than connect, I was able to track down a few without actually having the executable (http://www.scribd.com/doc/40108893/Cisco-VPN-Client-Command-Line).
That said, I do not believe that there is a switch that will help you create a connection. These are either done manually through the GUI, or can be likely be added by supplying a properly formatted file in the proper place.
If you're using the version of the Cisco VPN client I think you are, then your connection settings, or profiles, are stored in individual .pcf files somewhere on your computer (likely in the Cisco directory). These are simple, text-based files. Find one
on your computer, save it with another name, and then modify it manually. If you really want to use PowerShell, then use this opportunity to learn how to create and edit basic text files using PowerShell. If you have a standard connection file, then you can
put that file onto remote computers any number of ways. If a .pcf file exists in the proper place when the VPN client is opened, then it likely will not prompt for a new connection.
Update: Added more info; clarified -
Multiple Network Device Groups when importing to ISE using template
I have a question about importing a group of network devices into ISE using the template provided. The template only has a single column for Network Device Groups - is there a way to import devices and include more than one NDG? For instance, the NDG's we use are "Device Type" and "Location". I'd like to include both when doing my import and I've tried multiple ways to seperate the two strings within the column (comma's colons, semi-colons, spaces, pipes, tabs, etc), but i always get an error message that "NDG group does not exist". I also tried adding a new column into the template, but that just plain failed to import.
If there is any way to do this, I would appreciate any advice on how - I have to add about 40 devices per week to our ISE deployment and I'd rather not have to go in and add any parameters manually if it can be helped. Thanks very much!
Ross
BTW, we are running ISE ver 1.1.2 in case it is relevant.Yes, you can do it. You have to use the pipe "|" to separate the groups. But please notice you must create the network device groups in advance.
For example, I have the following groups in my csv file to import a lot of network devices
Device Type#All Device Types#SWITCHES#375O-X|Location#All Locations#PERU#LIMA
But as a pre-requisite I have to create the network device groups.
If you have lots of network device groups, you can mass import them instead of creating them one by one.
Please rate if it helps -
Adding SLO using Powershell ?
Hi,
I am wondering if I can use SM Lets to manually add in SLO to a Work Item.
Why i am asking is that the SCSM workflow seem not responding while the new work items created. After we have discovered the issue, we restarted the services and everything else back to normal except the Work Item created during the problem windows do not
get SLA assign to it.
I am using the Powershell below but no luck yet.
$IRClass=Get-SCSMClass -name System.WorkItem.Incident$
$IRObject=get-scsmobject -class $IRClass
$IRTarget= $IRObject| ?{$_.id -eq "IR21199"}
#Get SLA Relationship Class
$SLAInstanceRel=Get-SCSMRelationshipClass -Name System.WorkItemHasSLAInstanceInformation
$SLAId="Response Time - 001"
$SLAInformmationHash=@{"id"=$SLAId}
New-SCSMObject -Class $SLAInstanceClass -PropertyHashtable $SLAInformmationHash
$NewSLA=Get-SCSMClass $SLAInstanceClass | Get-SCSMObject -Filter "id -eq $SLAId"
New-SCSMRelationshipObject -Relationship $SLAInstanceRel -Source $IRTarget -Target $NewSLA -Bulk
The powerShell above give me error"
New-SCSMRelationshipObject : A discovery data item was rejected because the item is already bound to another Membership relationship.
At line:1 char:1
+ New-SCSMRelationshipObject -Relationship $SLAInstanceRel -Source $IRTarget -Targ ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [New-SCSMRelationshipObject], DiscoveryDataLifetimeDependencyException
+ FullyQualifiedErrorId : Microsoft.EnterpriseManagement.Common.DiscoveryDataLifetimeDependencyException,SMLets.NewSCSMRelationshipObject
Want to know if there other alternative.
Thank you.The "mechanic" behind SLOs and Incidents (all Work Items) in SCSM is a little bit more complicated. Maybe this blog post from Anton is helpful:
SLA in SCSM 2012. Part 2. How it's works
In general: It's not just adding a relationship between the Incident and the SLO.
Hope this helps.
Andreas Baumgarten | H&D International Group -
Hello,
I need to basically find everyplace 'ADUser1' exists and then add a new 'ADUser2' with the same permissions as the first group.
I have created a script that runs through an entire web app and finds everyplace the AD account is directly given access to and access via a group. I then need to add the new user and assign the permissions from the first ADUser, copy them. Below
is not the entire script, just where I'm trying to add the new user. The rest of the script works fine to find the first user. I'm stuck with this part: $role = $_.RoleDefinitions[$newRoleDef]. I get an error that I can call a method
on a null valued experssion.. I guess I don't know how to specify to copy the role from the first user, and use it to set the new user?
#Get the Permissions assigned to user
$WebUserPermissions=@()
foreach ($RoleDefinition in $WebRoleAssignment.RoleDefinitionBindings)
$WebUserPermissions += $RoleDefinition.Name +";"
$newRoleDef = $RoleDefinition.Name
#write-host "with these permissions: " $WebUserPermissions
#Send the Data to Log file
"$($Web.Url) `t Site `t $($Web.Title)`t Direct Permission `t $($WebUserPermissions)" | Out-File C:\Apps\Scripts\Logs\UserAccessReport.csv -Append
$assignment = New-Object Microsoft.SharePoint.SPRoleAssignment($account)
$role = $_.RoleDefinitions[$newRoleDef]
$assignment.RoleDefinitionBindings.Add($role)
$_.RoleAssignments.Add($assignment)Hi,
According to your post, my understanding is that you want to copy user permission to another user via PowerShell.
Instead of copy permission to another user, we can get the user permission, assign the permission to a group, then add the other user to the group. Now the user would get the same permssion as this user.
http://get-spscripts.com/2010/07/adding-groups-with-permission-levels-to.html
http://blog.thefullcircle.com/2013/02/create-a-sharepoint-group-with-permissions-and-add-an-ad-group-to-it/
We can also use the third-party tool to achieve the same scenario.
http://permissionsmanager.codeplex.com/
http://www.boostsolutions.com/blog/how-to-copy-permissions-to-other-users-in-sharepoint/
Thanks,
Jason
Jason Guo
TechNet Community Support -
How to set security group as primary site collection admin and secondary site collection admin using powershell in sharepoint online site - office 365?
Hi,
According to your description, my understanding is that you want to set security group as admin of primary and secondary site collection using PowerShell command in office 365.
I suggest you can use the command below to set the group to site owner, then it will have the site collection admin permission.
Set-SPOSite -Identity https://contoso.sharepoint.com/sites/site1 -Owner [email protected] -NoWait
Here are some detailed articles for your reference:
https://technet.microsoft.com/en-us/library/fp161394(v=office.15)
http://blogs.realdolmen.com/experts/2013/08/16/managing-sharepoint-online-with-powershell/
Thanks
Best Regards
Jerry Guo
TechNet Community Support
Maybe you are looking for
-
My wife and I each have our own email address and calendar. These are on one IPad. The Ipad has a single ICloud account. What's the best way to backup both Calendars, etc? Does ICloud automatically back up every account on the same IPad? (I che
-
Operator="in" , Fetch Xml, MS CRM 2011
hi, i have a guid's string array. ex: string[] recordGuids; i want to use this in fetchxml by using condition operator "in". i have tried this below code but no success ("The remote server returned an error: NotFound."). var fetchXml = @"<fetch mappi
-
Damaged software display after downloading lion or upgrading.
Damaged software display after downloading lion or upgrading. When i want to upgrade my software evryting works fine. But after the download is done it says that the software is damaged. How can i fix this problem because i have done this so many tim
-
trying to rent movie from Apple TV. Message states a valid address is necessary to purchase. We have purchased about 15 show in the last month along. Any suggestion on how to update valid email address.
-
Lens Profiles listed as available, but missing in lr4
Hello, the lens profile of my Samsung 12-24mm F4-5.6 ED is listed by Adobe. It still does not appear in Lightroom 4.4 (french version). I shot with a NX300, only Raw Format. I'll be thankfull for any help.