I made a few changes, but now getting a (401) Unauthorized error, not sure what else I'm missing.
The Curl API command for moving device groups:
curl -X PUT --header "Content-Type: application/json" --header "Accept: application/json" --header "Authorization: Bearer Very long token" -d "\"\\\\RootFolder\\New folder\"" "https://SOTIServer.com:443/MobiControl/api/devicegroups/%255C%255CRootfolder%255COld%2520folder%255CSourceFolder/path"
The Powershell call that I have so far, that doesn't work:
$folderX="SourceFolder"
function MoveDir ([string]$Name, [string]$Token)
{
$Path = "%255C%255CRootfolder%255COld%2520folder%255C" + $folderX
$body = @{}
$body = "`"\\RootFolder\New Folder`""
$body = $body | ConvertTo-Json
$Header2 = @{}
$Header2["Authorization"] = "Bearer " + $Token
try
{
$response2 = Invoke-restmethod -Uri https://$MCFQDN/mobicontrol/api/devicegroups/$Path/path -ContentType "application/json" -Method PUT -Body $body -Headers $Header2
}
catch
{
$($_.Exception.Message)
}
}