AnsweredAssumed Answered

PowerShell Command to create new Computers

Question asked by Oz Merchant Administrator on Jul 5, 2016

(Originally posted on 7, January 2016 by Wesley Ryan)

Spent a bit of time trying to figure it out so thought I would share with the community.

 

$creds = Get-Credential EMAIL@EMAIL.COM$xmlfile = [xml] @"
<hardware><name>LAPTOP1</name><bio><ssn>12345678</ssn></bio><site><name>Site Name</name></site><status><name>Operational</name></status></hardware>
"@
$headers = @{"Accept"="application/vnd.samanage.v1.1+xml"}
Invoke-WebRequest -Uri "https://api.samanage.com/hardwares.xml"; -Body $xmlfile -Credential $creds -ContentType "text/xml" -Headers $headers -Method Post

Outcomes