This an powershell script to generate reports of desktops, users and servers in Active Directory.
As for desktops the collected attributes are:
As for users the collected attributes are:
As for server the collected attributes are:
To generate reports powershell Active Directory must meet the following requirements:
The steps to run the script are as comments within the script
#Steps to generate reports:
#1. Run powershell as administrator
#2. write in the powershell console following:
import-module ActiveDirectory
#3. To get the report from desktops and laptops to run the following:
GET-ADCOMPUTER -filter {OperatingSystem -NotLike "*server*"} -properties * |select-object name,OperatingSystem,lastlogondate,ipv4address,primarygroup| Export-csv C:\desktopsAD.csv -notypeinformation -encoding utf8
#4. To get the report user to run the following:
GET-ADUSER –filter * -properties * |select-object name,lastlogondate,enabled,primarygroup | Export-csv C:\usersAD.csv -notypeinformation -encoding utf8
#5. To get the report server to run the following:
GET-ADCOMPUTER -filter {OperatingSystem -Like "Windows *server*"} -properties * |select-object name,OperatingSystem,lastlogondate,ipv4address,primarygroup| Export-csv C:\serverAD.csv -notypeinformation -encoding utf8
#These commands generate files called desktopsAD.csv, usersAD.csv and serverAD.csv at the root of drive C.
#Steps to generate reports: #1. Run powershell as administrator #2. write in the powershell console following: import-module ActiveDirectory #3. To get the report from desktops and laptops to run the following: GET-ADCOMPUTER -filter {OperatingSystem -NotLike "*server*"} -properties * |select-object name,OperatingSystem,lastlogondate,ipv4address,primarygroup| Export-csv C:\desktopsAD.csv -notypeinformation -encoding utf8 #4. To get the report user to run the following: GET-ADUSER –filter * -properties * |select-object name,lastlogondate,enabled,primarygroup | Export-csv C:\usersAD.csv -notypeinformation -encoding utf8 #5. To get the report server to run the following: GET-ADCOMPUTER -filter {OperatingSystem -Like "Windows *server*"} -properties * |select-object name,OperatingSystem,lastlogondate,ipv4address,primarygroup| Export-csv C:\serverAD.csv -notypeinformation -encoding utf8 #These commands generate files called desktopsAD.csv, usersAD.csv and serverAD.csv at the root of drive C.