If you are visiting for the first time. Have a look at my other blogs. I have posted some cool stuffs.

https://tekcookie.com/

Please have a look at other one liner seasons
https://tekcookie.com/powershell-one-liner-season-2/
https://tekcookie.com/powershell-one-liner/



Get all GPO Linked to an OU

(Get-GPInheritance -Target "OU=Test_Windows10_USB,OU=Test_Windows10,DC=domain,DC=org" | select GpoLinks).GpoLinks | select DisplayName

Get all GPO Inherited to an OU

(Get-GPInheritance -Target "OU=Test_Windows10_USB,OU=Test_Windows10,DC=domain,DC=org" | select InheritedGpoLinks).InheritedGpoLinks | select DisplayName

Link a GPO to an OU

New-GPLink -Name "USB_Enable" -Target "OU=Test_Windows10_USB,OU=Test_Windows10,DC=domain,DC=org"

Find Host Name from IP Address from DNS record (without Reverse lookup zone)

Get-DnsServerResourceRecord -ZoneName domain.local -ComputerName DNSServerName | select hostName -ExpandProperty RecordData | where {$_.IPv4Address -like "192.168.100.200"}

Find installed windows updates

Get-HotFix -ComputerName "hostname" | Where-Object {$_.InstalledOn -gt (Get-Date).AddDays(-30)}
Get-WmiObject -Class win32_quickfixengineering | Where-Object {$_.InstalledOn -gt (Get-Date).AddDays(-30)}

Get last successful Windows update checked and installed date

(New-Object -ComObject "Microsoft.Update.autoupdate").Results

Get loggedon user in a remote system

Get-WmiObject -Class Win32_ComputerSystem -ComputerName hostname | select username
QUERY USER /servername:hostname

Thank you for reading my post. Hope this is helpful to you.