- Details
- Written by: Senka
- Category: Power Shell
- Hits: 1147
$computers = Get-ADComputer -filter {OperatingSystem -like '*server*'} -Properties * | Select Name,OperatingSystem,OperatingSystemVersion,OperatingSystemServicePack, PrimaryGroup,IPv4Address,IPv6Address,CanonicalName,WhenCreated, LastlogonTimestamp,PasswordLastSet,@{Name="Disabled"; Exp={$_.useraccountcontrol -band 2}}| ?{$_.Disabled -eq 0}
- Details
- Written by: Senka
- Category: Power Shell
- Hits: 998
$date = (Get-Date).AddDays(-90)
Get-ADUser -Filter {lastlogontimestamp -gt $date} -property * | Select SamAccountName,Name, EmailAddress,CanonicalName,Manager,lastlogontimestamp,@{Name="Disabled"; Exp={$_.useraccountcontrol -band 2}}| ?{$_.Disabled -eq 0} | export-csv active_users.csv -Delimiter ";" -NoTypeInformation -Encoding Default
- Details
- Written by: Senka
- Category: Power Shell
- Hits: 1088
$group = Get-AdGroup "Users"
Get-ADUser -Filter {MemberOf -recursivematch $group.DistinguishedName} | select name,samaccountname
- Details
- Written by: Senka
- Category: Power Shell
- Hits: 1164
Import-Module ActiveDirectory
$computers = Get-ADComputer -filter * -Properties * | Select Name,OperatingSystem,OperatingSystemVersion,OperatingSystemServicePack,PrimaryGroup, IPv4Address,IPv6Address,CanonicalName,WhenCreated,LastlogonTimestamp, PasswordLastSet,@{Name="Disabled"; Exp={$_.useraccountcontrol -band 2}}| ?{$_.Disabled -eq 0}
- Details
- Written by: Senka
- Category: Power Shell
- Hits: 1063
Get-Content "filetest.txt" | ForEach-Object {$t1 = get-date -Format hh:mm:ss.fff; $content = Get-ChildItem $_ | Select-Object -First 1 *; $t2 = get-date -Format hh:mm:ss.fff; echo $t1`t$t2`t$_ }