AD computers report


Get-ADComputer -Filter * -Property * | Select-Object Name,OperatingSystem,DistinguishedName,modifyTimeStamp,LastReboot | Export-CSV AllWindows.csv -NoTypeInformation

Advertisements

Find All Active/Used IP Addresses on Your Network


Open the Command Prompt and type in the following:

FOR /L %i IN (1,1,254) DO ping -n 1 192.168.10.%i | FIND /i “Reply”>>c:\ipaddresses.txt

Powershell getting the RID pool values


function Grab-RidWaterMark
{
param ($domainDN)
$de = [ADSI]”LDAP://CN=RID Manager$,CN=System,$domainDN”
$return = new-object system.DirectoryServices.DirectorySearcher($de)
$property= ($return.FindOne()).properties.ridavailablepool

#get the high/low parts of int64 value, which is the samething that “large integer converter: in LDP is doing.
[int32]$totalSIDS = $($property) / ([math]::Pow(2,32))
[int64]$temp64val = $totalSIDS * ([math]::Pow(2,32))
[int32]$currentRIDPoolCount = $($property) – $temp64val

Write-Host “Total SIDs that can be created: $totalSIDS”
Write-Host “Latest RID pool high water mark: $currentRIDPoolCount”
}

Results:

PS C:\> Grab-RidWaterMark -domainDN “dc=brad,dc=forest,dc=test”
Total SIDs that can be created: 1073741823
Latest RID pool high water mark: 12271600

Refer :

https://blogs.technet.microsoft.com/brad_rutkowski/2010/04/23/iadslargeinteger-in-powershell-getting-the-rid-pool-values/

Export Ping status of set of Computers


Get-Content C:\Users\gsmcwl2\Desktop\computers.txt | ForEach-Object{
$pingstatus = “”
IF (Test-Connection -BufferSize 32 -Count 1 -ComputerName $_ -Quiet) {
$pingstatus = “Online”
} Else {
$pingstatus = “Offline”
}

New-Object -TypeName PSObject -Property @{
Computer = $_
Status = $pingstatus }
} | Export-Csv C:\Users\gsmcwl2\Desktop\PingStatus.csv -NoTypeInformation -Encoding UTF8

Getting it all into a file


Get-ADComputer -Filter * -Property * | Select-Object Name,OperatingSystem,OperatingSystemServicePack,OperatingSystemVersion | Export-CSV AllWindows.csv -NoTypeInformation -Encoding UTF8

# with IP address

Get-ADComputer -Filter * -Property * | Format-Table Name,OperatingSystem,OperatingSystemServicePack,OperatingSystemVersion,IPv4Address -Wrap –Auto

Refer :

https://blogs.technet.microsoft.com/askds/2010/02/04/inventorying-computers-with-ad-powershell/

PS command using start services


Get-Service iphlpsvc | %{ if ( $_.Status -eq "Stopped" ) {
  Start-Service iphlpsvc
}}

Managing the System Managed Page File

%d bloggers like this: