Replace Win32_Product class in GPO WMI filter - wmi

I actually use a WMI filter in multiple GPO with call at Win32_Product class. Example: Select * from Win32_Product WHERE ( Caption="Microsoft Office Standard 2016")
Unfortunately it is not a good practise : https://learn.microsoft.com/en-us/troubleshoot/windows-server/admin-development/windows-installer-reconfigured-all-applications
I don't have SSCM client to directly use Win32reg_AddRemovePrograms class.
Is there an other simple way to filter the application of the GPO (Like in the example on only computer with Microsoft Office Standard 2016). Create a WMI filter on GPO to check specific registred keys for example instead of Caption attribute ?
Regards
Albert
Use Win32reg_AddRemovePrograms -> SSCM client not installed
Use StdRegProv -> No result maybe because wrong namespaces

Related

What WMI class stores Deployment Type installation program on MECM

I need to retreive a data related the MECM Application via WMI classes, more specifically, I need to get Application Deployment Type properties - Installation / Uninstallation programs.
Could you please help me, what exact WMI class can I use to obtain this information.
Thank you for any help.
This is unfortunately not very easy to get information afaik, but with some help from powershell (or any programming language that can access wmi really) it can be done.
The information itself is stored within the Class SMS_Application in the Property SDMPackageXML.
Now the first thing you will notice if you query this is it is probably empty. That is because it is a lazy property. To work around this in PS you have to for example call an extra get() on your wmi object.
If you do this (or have some tool that just shows all lazy parameters anyway) you will notice it is - as suggested by the name - basically an XML document, that stores the information you need deep inside. So you have to extract it from within the XML.
Some example code on how to do this for a single app would be:
$app = Get-WmiObject -Class SMS_Application -Namespace "root\SMS\site_sitecode" -computer "your site server" -Filter "LocalizedDisplayName='your app name'"
$app.Get()
$installCMD = (([xml](($app).SDMPackageXML)).AppMgmtDigest.DeploymentType.Installer.InstallAction.Args.Arg | where {$_.Name -ieq "InstallCommandLine"}).'#text'
$uninstallCMD = (([xml](($app).SDMPackageXML)).AppMgmtDigest.DeploymentType.Installer.InstallAction.Args.Arg | where {$_.Name -ieq "UninstallCommandLine"}).'#text'
I'm not great with xml parsing so there might be a better way to do it or maybe you don't need the parsing but can just string compare the xml digest. Just start by looking at a SDMPackageXML and then you will probably see how to best analyze it for your own needs.

How to extract Markup relation with Teamcenter C++ API?

In Teamcenter I have a dataset that contains two inner datasets:
A "Good ds" dataset with an External Proxy relation.
A "Bad ds" dataset with Markup(s) relation
I'm trying to enumerate server content using the Teamcenter C++ API. The object for the "Good ds" dataset is returned as expected by call to get_IMAN_external_object_link() from the Teamcenter::Soa::Client::Model::Dataset class.
How could I get an object for the "Bad ds" dataset with Markup relation?
Documentation for the API is very poor. I've tried each of these methods in the Dataset class that returns a ModelObjectVector but with no luck:
get_DgtSignatureByUserRelation
get_external_apps
get_fnd0complying_objects
get_fnd0defining_objects
get_Fnd0DiagramSnapshot
get_Fnd0DiagramTmplRelation
get_Fnd0Diagram_Attaches
get_fnd0FileAccessAuditLogs
get_fnd0GeneralAuditLogs
get_fnd0LicenseExportAuditLogs
get_Fnd0ShapeRelation
get_fnd0WorkflowAuditLogs
get_FND_TraceLink
get_IMAN_based_on
get_IMAN_Rendering
get_license_list
get_process_stage_list
get_release_statuses
get_revisions_prop
Teamcenter server version is 10.1 (20130604.00).
I believe you need to write a custom SOA (Service Oriented Architecture) API to to fulfill this particular need.
You to have the BMIDE (Business Modeler IDE). In it you need to create a new BMIDE template and setup the project appropriately.
Go to Advanced mode -> Extensions tab-> **Code -> Libraries -> create new SOA library (names may be inaccurate).
Now add custom service. Write ITK (Integrated Toolkit) code to fetch the information you need.
Then install this template to Teamcenter through TEM (Teamcenter Environment Manager).
Now you can call this API through your Client whether it is RAC (Remote Access Client) or any UI Client.
Let me know if something is not clear.
Alternatively, you can look for methods that exist for all the ModelObjects. You should look for a Relation Property and fetch the target from it using the API whose return type should be ModelObject/array of ModelObject (I don't know what exactly to look for).

Querying information from the Windows Active Directory

Is there a possibility to query information from the AD in c++?
I'm especially interested in the value of the second field of "User logon name (pre-Windows 2000):" on the "Account" tab.
Other languages would also be fine.
Thanks in advance!
Yes. You can either use ADSI (via COM) or LDAP (via the wldap32 library) as two starting points. The attribute you want is called sAMAccountName.

Retrieving Enterprise Project Types using Project Server Interface

I am currently building an app to programatically create projects in Microsoft Project Server using the web services exposed through the Project Server Interface (PSI).
I am able to create a project with an Enterprise Project Type using the QueueCreateProject method, however, I need to specify the GUID of the EPT which I don't want to hard code into the code.
Is there another web service or way to get the GUID of a specific EPT found by its name?
Also, can the same be done for custom fields in the same way?
I think what you're looking for is PSI Filter parameters. Check out this post for an example of retrieving the Guid of a custom field.
Really, I think the key is setting the filter criteria:
cfFilter.Criteria = new PSLibrary.Filter.FieldOperator(equal, nameColumn, customFieldName);
Where nameColumn is cfDataSet.CustomFields.MD_PROP_NAMEColumn.ColumnName and customFieldName is a value you pass in.
If you are like me, you want to do this for a lot of fields. I used a filter to query all the field names and MD_PROP_UID's and then just put it in a hashtable so I don't have to keep making PSI calls.
Disclaimer: I use 2007 but I'm assuming it is mostly the same for custom fields (not for the EPT part which I didn't include).
Here is an answer: https://stackoverflow.com/a/12267251/1594383
In short: the methods are available from Workflow service.

SharePoint Web Services - Updating ContentType field Required property?

I've been trying to programmatically reproduce the behavior of editing a Content Type's field properties in the SharePoint site management screen and selecting the "Required" radio button with no sucess using the WSS 3.0 web service's Webs.asmx "UpdateContentType" method.
The first difficulty was the issue with the MSDN documentation that said fields should be of a FieldRef type when in fact they need to be of a Field type (reference). Adding fields and deleting fields works fine after the fix, but updating fields seems to not function at all. (It should also be noted that I followed the recommendation on the previous link to use Method="2" for updating fields but it changes nothing, and using Method values other than 1 for adding or other than 3 for deleting also function correctly).
Here's the web service call (slightly modified with strings instead of XmlNode objects for readability):
SharePointWebServices.Webs webService = new SharePointWebServices.Webs();
webService.Url = "http://mysharepointserver/site";
webService.UseDefaultCredentials = true;
webService.UpdateContentType(
#"0x01005A089D9EC8A382458FB1F6C72096D52A",
#"<ContentType />",
#"<Fields />",
#"<Fields><Method ID=""1""><Field Name=""SomeField"" ID=""{8a4803c4-6545-4a7a-804d-237eebff0ce3}"" Required=""TRUE"" Hidden=""FALSE"" ReadOnly=""FALSE"" PITarget="""" PIAttribute="""" PrimaryPIAttribute="""" Aggregation="""" Node="""" /></Method></Fields>",
#"<Fields />");
After the call, the field is still Required="FALSE".
A quick look into the stssoap.dll assembly indicates that the "Required" property is apparently ignored during the update process. Is this normal behavior? If so, what is the recommended method for programmatically changing the "Required" field from client code (not executing on the SharePoint server)?
Any help would be greatly appreciated.
I've investigated this and found the same thing. I also tried adding the attribute Cmd="Update" to the Method element without success. This example of how to use UpdateContentType was helpful too.
I don't believe you will be able to do this with the out-of-the-box SharePoint services. You've verified from looking at stssoap.dll that this doesn't appear to work correctly. Another 'client'-style option is to use RPC methods but none appear to provide functionality for content types at all.
The web services are particularly frustrating because this type of not-so-edge case regularly comes up. It is very rare that I consider using them because of the time wasting involved with their limitations.
Do you have any option of deploying custom code to the server? You could develop this functionality using the object model and wrap it in your own custom web service (there is a walkthrough here) quite easily.
Here is an example adapted from Gabe Wishnie that does what you require:
SPContentType myContentType = myWeb.ContentTypes["myContentType"];
string internalName = myContentType.Fields["fieldToUpdate"].InternalName;
myContentType.FieldLinks[internalName].Required = false;
myContentType.Update(true);
Sorry this isn't more helpful but it's a common story when using the WSS 3.0 / SharePoint 2007 web services.