Below is a short PowerShell script that you can use to export data from Active Directory and import into your SwipedOn web dashboard. 

By using this script, you can export employee records from Active Directory into a neatly formatted CSV file that's ready for upload into our SwipedOn system.

__________________________________________________________________

Powershell Script Considerations

  • Export-SwipedOnCSV.ps1.
  • This short script exports contacts from Active Directory into a CSV format suitable for SwipedOn.com.
  • The Select-Object removes '.' from the "first_name" field, or else you will get an "Illegal Character" warning when uploading your CSV.
  • You might have to change the "mobilephone" property in Get-ADUser depending on where you store your phone number values in AD.

__________________________________________________________________

Powershell Script 

$UsersOU = "OU=Users,OU=YourOU,OU=Somewhere,DC=company,DC=tld"
$CSVpath = "\\some\folder\swipedon.csv"
Get-ADUser -SearchBase $UsersOU -Filter {Enabled -eq $true} -Properties givenname, surname, emailaddress, mobilephone |
Select-Object @{n="first_name";e={($_.givenname).replace(".","")}}, @{n="last_name";e={$_.surname}}, @{n="email";e={$_.emailaddress}}, @{n="phone";e={($_.mobilephone).replace("+","00")}} |
Export-Csv -Path $CSVpath -Force -NoTypeInformation -Encoding UTF8

Did this answer your question?