Export CSV in powershell with Domain name in title -
We are auditing various networks and there is a need to distinguish between domains. The code I am currently using will export .csv, but I use the title that I have selected so that's what I need for it. To name the CCV file by its domain name automatically.
Below is my current code:
import-module ActiveDirectory Get-ADObject -filter 'objectclass -eq' user "'-properties CN, DisplayName, Discription | select | Export-csv -noTypeInformation "c: \ ADUsers.csv"
Do you want it now Is the original domain included with the current domain, or domain?
Current domain name:
import-module ActiveDirectory $ name = Go-ADDomain | Select - Expand Privacy NetBIOSName Add-Object - Filter 'Object-A' User " '-piptsize cn, display, discriptio | Select | Export-Csv-NoTypeInformation "c: \" + $ name + ".csv"
Comments
Post a Comment