-
Notifications
You must be signed in to change notification settings - Fork 1
/
get-CORPcompInfo.psm1
21 lines (18 loc) · 1021 Bytes
/
get-CORPcompInfo.psm1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
function get-CORPcompinfo {
param ([string]$lt)
$server = "dreamthief.co"
Try
{
Get-ADComputer -server $server -Credential $creds $lt -properties `
enabled, description, dnshostname, objectclass, location, managedby, ipv4address, whencreated, whenchanged,CanonicalName, OperatingSystem, OperatingSystemVersion, pwdlastset, lastlogon |
select enabled, dnshostname, description, `
@{Name="Last Known IP address";Expression={ $psitem.ipv4address }}, `
objectclass, location, managedby, whencreated, whenchanged, OperatingSystem, OperatingSystemVersion, `
@{Name="PwdLastSet";Expression={[datetime]::FromFileTime($_.PwdLastSet)}}, `
@{Name="LastLogon";Expression={[datetime]::FromFileTime($_.LastLogon)}}, `
@{Name="LastLogonTimeStamp";Expression={[datetime]::FromFileTime($_.LastLogonTimeStamp)}},
@{Name="OU Location";Expression={ $psitem.CanonicalName }}
}
Catch{
Write-host "The Computername $lt was not found" -ForegroundColor Red
}}