
$URI = $result.instance_url+"/services/data/v38.0/sobjects/user/"

#building the script
$URI = $result.instance_url+"/services/data/v38.0/sobjects/user/"
$method = "POST"
$contenttype = "application/json"
 

$Body = @{Username="ab@Email"
            LastName="aa"
            FirstName="bb"
            Email="ajer@EMAIL"
            Alias="abcd"
            CommunityNickname="abcd"
            IsActive="false"
            TimeZoneSidKey="America/New_York"
            LocaleSidKey="en_US"
            EmailEncodingKey="ISO-8859-1"
            ProfileId="PROFILEID"
            LanguageLocaleKey="en_US"
            UserPermissionsMobileUser="false"
            UserPreferencesDisableAutoSubForFeeds="false"
            }



$body2 = $body | ConvertTo-Json
             
Invoke-restmethod -URI $URI -contenttype $contenttype -Method $method  -Body $Body2 -Headers @{"Authorization" = "OAuth " + $access_token;"Accept"="application/json"}




