This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

SPML to create computer object

I am trying to create computer objects via SPML. I have the following XML file and I post it using PowerShell invoke-webrequest cmdlet. It doesn't work - the computer object doesn't get created but I don't get any error either. Using the same method to create a user works fine.

 

Here is my XML:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <addRequest xmlns="urn:oasis:names:tc:SPML:2:0" returnData="everything">
      <data>
        <attr name="edsvaParentDN" xmlns="urn:oasis:names:tc:DSML:2:0:core">
          <value>"ou=computers,OU=MyOU,DC=blahblah,DC=blahblah"</value>
        </attr>      
        <attr name="cn" xmlns="urn:oasis:names:tc:DSML:2:0:core">
          <value>MyTestPC</value>
        </attr>
        <attr name="objectClass" xmlns="urn:oasis:names:tc:DSML:2:0:core">
          <value>computer</value>
        </attr>      
      </data>
    </addRequest>
  </soap:Body>
</soap:Envelope>
 
 
This is what I get back:
 
StatusCode        : 200
StatusDescription : OK
Content           : <?xml version="1.0" encoding="utf-8"?><soap:Envelope
                    xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
                    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLS...
RawContent        : HTTP/1.1 200 OK
                    Persistent-Auth: true
                    Content-Length: 515
                    Cache-Control: private, max-age=0
                    Content-Type: text/xml; charset=utf-8
                    Date: Tue, 06 Feb 2018 21:22:40 GMT
                    Server: Microsoft-IIS/8.0
                    X...
Forms             : {}
Headers           : {[Persistent-Auth, true], [Content-Length, 515], [Cache-Control, private, max-age=0],
                    [Content-Type, text/xml; charset=utf-8]...}
Images            : {}
InputFields       : {}
Links             : {}
ParsedHtml        : System.__ComObject
RawContentLength  : 515
 
 
 
 
Am I missing something in the XML?
 
Thanks in advance.
  • Equally interested in this featurette ... Any expertise in the wings?
    We'd like to offer Computer Create via SPML for internal vmware group.
  • Something like this should work as long as your SPML Config is set up for these attributes.

    #$cred = get-credential
    $body = @"
    <?xml version="1.0" encoding="utf-8"?>
    <soap12:Envelope xmlns:xsi="www.w3.org/.../XMLSchema-instance" xmlns:xsd="www.w3.org/.../XMLSchema" xmlns:soap12="www.w3.org/.../soap-envelope">
    <soap12:Body>
    <addRequest xmlns="urn:oasis:names:tc:SPML:2:0" returnData="everything">
    <psoID ID="CN=SPMLComputer4,OU=SPML,OU=TESTOU,DC=acme,DC=corp"/>
    <data>
    <attr name="objectClass" xmlns="urn:oasis:names:tc:DSML:2:0:core">
    <value>computer</value>
    </attr>
    <attr name="samAccountName" xmlns="urn:oasis:names:tc:DSML:2:0:core">
    <value>SPMLComputer4$</value>
    </attr>
    <attr name="description" xmlns="urn:oasis:names:tc:DSML:2:0:core">
    <value>My test computer</value>
    </attr>
    </data>
    </addRequest>
    </soap12:Body>
    </soap12:Envelope>
    "@

    $webRequest = Invoke-RestMethod -Uri 'VM-WS2008R2-1/.../SPMLProvider.asmx' -Credential $cred -Body $body -Method Post -ContentType 'application/soap+xml; charset=utf-8'

  • Try something like this.

    #$cred = get-credential
    $body = @"
    <?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>
         <addRequest xmlns="urn:oasis:names:tc:SPML:2:0" returnData="everything">
          <psoID ID="CN=SPMLComputer4,OU=SPML,OU=TESTOU,DC=acme,DC=corp"/>
          <data>
            <attr name="objectClass" xmlns="urn:oasis:names:tc:DSML:2:0:core">
              <value>computer</value>
            </attr>
            <attr name="samAccountName" xmlns="urn:oasis:names:tc:DSML:2:0:core">
              <value>SPMLComputer4$</value>
            </attr>
            <attr name="description" xmlns="urn:oasis:names:tc:DSML:2:0:core">
              <value>My test computer</value>
            </attr>
          </data>
        </addRequest>
      </soap12:Body>
    </soap12:Envelope>
    "@
    
    $webRequest = Invoke-RestMethod -Uri 'http://VM-WS2008R2-1/ARServerSPML/SPMLProvider.asmx' -Credential $cred -Body $body -Method Post -ContentType 'application/soap+xml; charset=utf-8'