Hi Folks,
I am novice to PowerShell Scripting and managed to build a query which can fetch user object in .csv file.
Here is Query I used for fetching the AD data
Import-Module Activedirectory
Get-ADuser -LdapFilter "(&(objectCategory=person)(!sAMAccountName=*$)(!sAMAccountName=IUSR*)(!sAMAccountName=IWAM*))" -Properties SamAccountName,GivenName,Surname,Title,mail,Enabled, Manager,Department,Office,telephoneNumber | select @{N="LogonName";E={$_.SamAccountName}},@{N="FirstName";E={$_.GivenName}},@{N="LastName";E={$_.Surname}},Title,@{N="Email";E={$_.mail}},@{N="AccountIsDisabled";E={Switch
($_.Enabled){$True {$False};$False {$True}}}}, Manager,Department,Office,telephoneNumber | export-csv C:\ADexport.csv –NoTypeInformation
The problem I am facing here is, I am not able to export data into .xlsx format. I know we can do it later by just changing the extension into .xlsx but I want this to be automated.
Please suggest something which can help me out getting the Powershell output directly into .xlsx format
Regards,
Mahendra
msc