Friday, January 20, 2023

 

Import-Module ActiveDirectory

$SampleDate = Get-Date -Format g

 

 

$status= Get-ADUser -Filter * -SearchBase 'ou=CA,dc=dshs,dc=wa,dc=lcl ' -Properties displayname, givenname, initials, sn, description, title, physicaldeliveryofficename, telephonenumber, mail, streetaddress, l, st, postalcode, manager, department, location, samaccountname, employeeID, distinguishedName,created|

select displayname, givenname, initials, sn,  description, title, physicaldeliveryofficename, telephonenumber, mail, streetaddress, l, st, postalcode, manager, department, location, samaccountname, employeeID, DistinguishedName, created

C:\Scripts\SQLInsertObject1.ps1 $status -server "databaseserver" -db "CATSAMDB" -sql "select * from ADUSER_CA_Users" -truncateTable $True