Workrite quick and dirty user creation from AD when you already have SSO

This is ugly but it’ll get you started, there are definitely better ways. User creation script for

[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12

$Workriteuser="{workrite username}"
$WorkritePW="{workrite password}"
$WorkriteID="{workrite ID}"


$BaseOUS| ForEach-Object{

	get-aduser -properties mail,employeenumber -searchbase $_ -filter {enabled -eq "True" -and emailaddress -like "*"} -resultsetsize 10000 | foreach-object {

	$mailaddress = $_.mail
	$firstname = $_.givenname
	$surname = $_.surname
	$employeeid = $_.employeenumber


	$url = $url -replace '\s',''

	[xml]$output = Invoke-WebRequest "$url"
		#API response 13 duplicate username
		if ($"#text" -eq "13")
			Write-Host "User $mailaddress already exists"
		#API Response 0 success
		elseif ($"#text" -eq "0")
			Write-Host "User $mailaddress successfully created"