Giter VIP home page Giter VIP logo

configmgrwebservice's Introduction

ConfigMgr WebService

ConfigMgr WebService has been designed to extend the functionality of Operating System Deployment with Configuration Manager 2012 (and above). These methods provided by this web service enables you to build custom frontend / HTA applications.

The list below shows an overview of the available methods:

Configuration Manager

  • AddCMComputerToCollection
  • GetCMBootImageSourceVersion
  • GetCMDeployedApplicationsByDevice
  • GetCMDeployedApplicationsByUser
  • GetCMDeviceCollections
  • GetCMDeviceNameByUUID
  • GetCMDeviceResourceIDByMACAddress
  • GetCMDeviceResourceIDByUUID
  • GetCMDiscoveredUsers
  • GetCMDriverPackageByModel
  • GetCMHiddenTaskSequenceDeployments
  • GetCMHiddenTaskSequenceDeploymentsByResourceId
  • GetCMPackage
  • GetCMPrimaryDeviceByUser
  • GetCMPrimaryUserByDevice
  • GetCMUniqueUserName
  • GetCMUnknownDeviceByUUID
  • ImportCMComputerByMacAddress
  • ImportCMComputerByUUID
  • RemoveCMUnknownDeviceByUUID
  • UpdateCMCollectionMembership

Microsoft Deployment Toolkit

  • AddMDTRoleMember
  • AddMDTRoleMemberByAssetTag
  • AddMDTRoleMemberByMacAddress
  • AddMDTRoleMemberBySerialNumber
  • AddMDTRoleMemberByUUID
  • GetMDTComputerByAssetTag
  • GetMDTComputerByMacAddress
  • GetMDTComputerBySerialNumber
  • GetMDTComputerByUUID
  • GetMDTComputerNameByIdentity
  • GetMDTComputerRoleMembership
  • GetMDTDetailedComputerRoleMembership
  • GetMDTRoles
  • RemoveMDTComputerFromRoles

Active Directory

  • AddADComputerToGroup
  • SetADComputerDescription
  • SetADOrganizationalUnitForComputer
  • RemoveADComputerFromGroup

Supported Configurations

This web service has been built to support the following versions of System Center Configuration Manager:

  • Configuration Manager 2012 SP1
  • Configuration Manager 2012 SP2
  • Configuration Manager 2012 R2
  • Configuration Manager 2012 R2 SP1
  • Configuration Manager Current Branch (all currently supported versions released by Microsoft)

Make sure that .NET Framework 4.5.2 is available on the member server you intend to host this web service on.

Installation instructions

To successfully run this web service, you'll need to have IIS installed on a member server with ASP.NET enabled. Easiest way to get going is to install the ConfigMgrWebService on the same server as where your Management Point role is hosted. You'll also need to have a service account for the application pool in IIS. It's recommended that you add the service account in ConfigMgr with Full Administrator privileges.

1 - Create folder structure

  1. Download the project and compile the solution in Visual Studio (you can download the free version called Visual Studio Community Edition)
  2. Create a folder in C:\inetpub called ConfigMgrWebService. Inside that folder, create a folder called bin.
  3. Copy the compiled ConfigMgrWebService.dll to C:\inetpub\ConfigMgrWebService\bin.
  4. Rename Web.Release.config to Web.config and copy it to C:\inetpub\ConfigMgrWebService.
  5. Copy ConfigMgrWebService.asmx to C:\inetpub\ConfigMgrWebService.
  6. Locate AdminUI.WqlQueryEngine.dll and Microsoft.ConfigurationManagement.ManagementProvider.dll in the ConfigMgr console installation location and copy them to C:\inetpub\ConfigMgrWebService\bin.

2 - Add an Application Pool in IIS

  1. Open IIS management console, right click on Application Pools and select Add Application Pool.
  2. Enter ConfigMgrWebService as name, select the .NET CLR version .NET CLR Version v4.0.30319 and click OK.
  3. Select the new ConfigMgrWebService application pool and select Advanced Settings.
  4. In the Process Model section, specify the service account that will have access to ConfigMgr in the Identity field and click OK.

3 - Add an Application to Default Web Site

  1. Open IIS management console, expand Sites, right click on Default Web Site and select Add Application.
  2. As for Alias, enter ConfigMgrWebService.
  3. Select ConfigMgrWebService as application pool.
  4. Set the physical path to C:\inetpub\ConfigMgrWebService and click OK.

4 - Set Application Settings

  1. Open IIS management console, expand Sites and Default Web Site.
  2. Select ConfigMgrWebService application and go to Application Settings.
  3. Enter values for each application settings, SiteServer being the server where the SMS Provider is installed, SiteCode being the site code of your site and SecretKey being a custom string that you create yourself.

Documentation

Application Settings

When calling the web service methods, you'll need to pass along a secret key that matches what's specified for the SecretKey application setting in web.config as a parameter. Without this parameter, the method will be invoked properly. This is a somewhat reasonable security mechanism (at least it's something) that prevents unathorized users to invoke the methods and retrieve data from your ConfigMgr environment. It's recommended that you generate a GUID and enter that as the SecretKey.

configmgrwebservice's People

Contributors

nickolaja avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

configmgrwebservice's Issues

SOAP API Request: Filter with [ ] does not work

Hey guys,

we are using the WebService (1.8.0) and I have a problem when requesting the GetCMDeviceCollection endpoint.
I'll use the python requests library and the payload looks like this:

<!--  Secret is removed. -->

<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
      <soap12:Body>
           <GetCMDeviceCollections xmlns="http://www.scconfigmgr.com">
           <secret>XXXXXXX-XXXXXXX-XXXXXXX-XXXXXX-XXXXXX</secret>
           <filter>[OSD]></filter>
           </GetCMDeviceCollections>
      </soap12:Body>  
</soap12:Envelope>

I try to filter something with square brackets and it is showing me everything... the request is not filtered... i also tried to use a CDATA element or some XML encoding... but this does not work either.

What is wrong?

Invoke-WebRequest : IIS 10.0 403.14 The Web server is configured to not list the contents of this directory.

Good day,
I receive error when tried to do first connect in ConfigMgr Web Service Diags:

Invoke-WebRequest :
IIS 10.0 Detailed Error - 403.14 - Forbidden
HTTP Error 403.14 - Forbidden
The Web server is configured to not list the contents of this directory.

I have MECM Version 2010, Console 5.2010.1093.3100, Site 5.0.9040.1000
DAT Version: 6.5.2 (for 20H2 machines)

I tried to fill SQL and MDT keys but without any success.

WebService

AD calls are working, but not CM calls.

I followed the manual installation guide and all seems to be configured properly. I provided my domain admin credentials as this is my lab to the IIS app pool, so I know it's not a permissions issue.

I intend on using this with OSDFrontEnd eventually. I'm running SCCM 1910.

2020-04-21_14-37-57_EmptyConfigMgrWebserviceResults
2020-04-21_14-52-10_InetLogs
2020-04-21_15-06-59_ConfigMgrWebServiceWebConfig
2020-04-21_15-04-57_ConfigMgrWebService
2020-04-21_15-11-22_SCCMSiteServerRoles

Dependency

Hi,

an application is configured with a dependency. All applications are loaded within a Task Sequence. GetCMApplication is used. The dependency isn't shown by GetCMApplication, therefore the Task Sequence breaks as the Dependency needs a reboot.

Any ideas? Is this a bug?

Thanks

MDT Customsettings.ini return error 500 when using url to call webservice fonction

Hello,

I need a little help on this one. I'm a complete beginer when it comes to use webservices in deployment with MDT, but I'm trying my best to make my way through it :)

So here is my issue :

In MDT I use the following customsettings.ini file to call the WebService but in return I get an error. To me it seems like I have an issue with the URL syntax in "WebService=http://srvdeploy01/ConfigMgrWebService/ConfigMgrWebService.asmx/GetADComputerDescription"

It's working fine when i'm testing it on my browser at : http://srvdeploy01/ConfigMgrWebService/ConfigMgrWebService.asmx?op=GetADComputerDescription

And it's working too when I'm using it trough powershell with try { $URI = "http://srvdeploy01/ConfigMgrWebService/ConfigMgrWebService.asmx" $WebService = New-WebServiceProxy -Uri $URI -ErrorAction Stop } catch [System.Exception] { Write-Warning -Message "An error occured while attempting to calling web service. Error message: $($_.Exception.Message)" ; exit 2 } $Invocation = $WebService.SetADComputerDescription($SecretKey, $ComputerDescription)

Any help, even a little would be greatly appreciated as I've no idea how to make this work on my own...

Thanks !

CustomSettingsini.txt
error 500 in ZTIGather log.txt

PS: The glimpse of my ZTIGather.log is partially in French, if that's an issue I can translate it with pleasure !

GetCMPrimaryUserByDeviceName

When using the function GetCMPrimaryUserByDeviceName I get several users back in my result that are not Primary Users, at least not according to the SCCM console.

I am using ConfigMgr WebService 1.8.0

SetADOrganizationalUnitForComputer - AD Site for installed computer

Hi Nickolaj,

First of all: great work with all your blogposts and ConfigMgr related solutions. Appreciate the effort and dedication!

I have a question for the function SetADOrganizationalUnitForComputer and the other AD related functions..

Scenario: Installed computer is located in site A and the ConfigMgrWebService server is installed in site B. Both sites have another AD controller assigned. If the computer is freshly installed and joined to AD, it will contact AD controller in site A. If I would like to move this computer object with the web services, it will connect to the DC in site B. If replication hasn’t taken place, it won’t find the computer and can’t manipulate it.

Have you taken this in consideration or how would you best solve this issue? Thanks!

GetCMPrimaryDeviceByUser filters by wrong parameter

It looks like the function GetCMPrimaryDeviceByUser filters by the wrong parameter. The query is identical to the one used in GetCMPrimaryUserByDevice and yelds the same result.

Solution:
Change the query from "WHERE ResourceName" to "WHERE UniqueUserName"

RemoveADComputer function does not work in a child domain

The RemoveADComputer function in child domain (parent domain works fine) does not work. The permissions in Active Directory is not the problem. When trying the function on http://server/ConfigMgrWebService/ConfigMgr.asmx, the following error is displayed:

System.NullReferenceException: Object reference not set to an instance of an object.
at ConfigMgrWebService.ConfigMgrWebService.RemoveADComputer(String secret, String samAccountName)

The GetADComputer function is working without problems in the child domain. Setting the Description with SetADComputerDescription is working as well.

[Request] Add SetDataDiscoveryRecord / GetDataDiscoveryRecord

Added web method SetDataDiscoveryRecord and GetDataDiscoveryRecord. Allows to set custom discovery data.

For example:
Operating System Name and Version = “Contoso Windows 10 1903”

OSD Collection Query:
select SMS_R_SYSTEM.ResourceID,SMS_R_SYSTEM.ResourceType,SMS_R_SYSTEM.Name,SMS_R_SYSTEM.SMSUniqueIdentifier,SMS_R_SYSTEM.ResourceDomainORWorkgroup,SMS_R_SYSTEM.Client from SMS_R_System where SMS_R_System.OperatingSystemNameandVersion = " Contoso Windows 10 1903"

After the client sends the heartbeat, It will automatically fall out of the OSD install collection

https://docs.microsoft.com/en-us/sccm/develop/core/servers/configure/how-to-create-a-data-discovery-record

That would be very helpful

dll file missing

going through the setup, the download did not include the compiled dll file. can you please provide.

[Request] Get-CMLastLogonUserByDevice

Hi Nickolaj!

Thanks for all the good work! I have received several requests, to get the LastLogonUser By Device with your ConfigMgrWebService. Can you include that please? Thank you!

Handling failed webservice calls?

I know very little about hosting/deploying web services, so please take that into account if you respond :)

I have been using this web service productively in my SCCM environment for some time now to perform just a few infrequent operations. On a couple of occasions, I've tried to use the webservice as part of a larger deployment operation that targeted a number of existing clients at the same time. It didn't go well, as many of the calls to the web service will timeout if too many calls are made around the same time by different clients. At this time, I really don't have a feel for what that threshold is, though.

In general, what is a realistic expectation for the level of workload that this web service is designed to handle if installed/configured using the default settings on a "typical" Windows Server? In general, does the service simply construct an internal queue of incoming requests and evaluate them one-at-a-time in the order received? And is there anything that can be done on the IIS side or in the configuration of the service to allow the service to handle a greater number of requests in a short period of time?

Again, I know very little about IIS, so any feedback (whether specific solutions or links to general IIS concepts) is appreciated!

GetADGroupMemberByUser - Authentication in OSDFrontend not working with multiple child domains

Hello everybody,

we have a problem with the authentication in OSDFrontend with our Users from child domain. Under our doman are many child domains and we would like a central group to put our "OSD Admins" in.
image

It is a universal security group with members from the child domains, these members could not authenticate in OSDFrontend.
image

There are no errors in the Event Log "ConfigMgr Web Service Activity".
The "OSDFrondEnd.log" return the following error message:
image

I have already done some research, it seems that in general the cmdlet "GetADGroupMemberByUser" does not work for child domains. I've also tried to create a group with the same name in the child domain, but this does not work either.

Is there anything else I can check or is there a way to fix this? Thank you in advance.

[Request] HTTPS Support

Hi Nicolaj,

First of all, great job on this web service it has been of tremendous value to us.

As a requirement from our security team, we tried to make the web service to run on HTTPS without success. Are there any special requirements for the web service to support https?

Thanks
Ioan

GetCMOSImageForTaskSequence

the GetCMOSImageForTaskSequence is not able to pull OS information if the Apply Operating System Image step in a TS is set to use an operating system from an original installation source

ConfigMgrWebService web config file issue

4 - Set Application Settings

Open IIS management console, expand Sites and Default Web Site.
Select ConfigMgrWebService application and go to Application Settings.

Getting below error's
Config File \?\C:\inetpub\ConfigMgrWebService\web.config
Config Error Configuration file is not well-formed XML

Thiswebconfig file is present web.release.config. As per instruction I have changed web.config and pasted configmgrwebservice folder under..

[Request]Retrieve current time from the web service

Possibility to retrieve current time from the web service. This way we could easily sync computer clock, evaluate how long deployments are lasting without caring WinPE time etc.

I think it would be a great and fast to implement feature to add.

What do you think?

[Request] GetCMCollectionsDirectMembershipRuleByDeviceName

Hi,
If we add a new device to our computer park to replace an old device, we give it a new name. Then we will have to find the directs rules.
Example device name:
Old device: Computer-Tony
New device: Computer-TonyX

It would be interesting to be able to retrieve the direct rules from a specific device:

GetCMCollectionsDirectMembershipRuleByDeviceName
GetCMCollectionsDirectMembershipRuleByResourceID
GetCMCollectionsDirectMembershipRuleByUUID

Can you include that please?
Thank you!

[Request] User functions

Would like to see user based functions such as the following:

AddCMUserToCollection
GetCMCollectionsForUserByName
GetCMCollectionsForUserByID
GetCMUserCollections
RemoveCMUserFromCollection

[Request] Get boundary group for computer

I don't know if this is possible in another way, but it would be helpful for us tho have this functionality.
We want to migrate our customers to one site and all of them use PXE OSD with (Unknown Computers deployment). We need a way to figure out which client owns the deployed computer and dynamically generate a list of task sequences for a specific computer without doing pre-staging. I was thinking to use boundary groups for that, hence the request.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.