piszczynski>Aleks No edit summary |
piszczynski>Aleks |
||
| Line 2: | Line 2: | ||
== Handy Powershell == | == Handy Powershell == | ||
Output Command History to text file: | |||
<pre> | |||
Get-History | ForEach-Object { $_.CommandLine } > $env.USERPROFILE\testoutput.txt | |||
</pre> | |||
Export details of users in a specific OU: | |||
<pre> | |||
$OUpath = '<place OU path here distinguished name of ou in attribute editor>' | $OUpath = '<place OU path here distinguished name of ou in attribute editor>' | ||
$ExportPath = '<place where to put output>' | $ExportPath = '<place where to put output>' | ||
Get-ADUser -Filter * -SearchBase $OUpath | Select-object DistinguishedName,Name,UserPrincipalName,sAMAccountName | Export-Csv -NoType $ExportPath | Get-ADUser -Filter * -SearchBase $OUpath | Select-object DistinguishedName,Name,UserPrincipalName,sAMAccountName | Export-Csv -NoType $ExportPath | ||
</pre> | |||
Revision as of 12:52, 22 May 2019
Handy Powershell
Output Command History to text file:
Get-History | ForEach-Object { $_.CommandLine } > $env.USERPROFILE\testoutput.txt
Export details of users in a specific OU:
$OUpath = '<place OU path here distinguished name of ou in attribute editor>' $ExportPath = '<place where to put output>' Get-ADUser -Filter * -SearchBase $OUpath | Select-object DistinguishedName,Name,UserPrincipalName,sAMAccountName | Export-Csv -NoType $ExportPath