Get-IPInfo.ps1 is a script which uses invoke-command to run Get-NetIPConfiguration from a remote computer. The result is a quick way to get the IP configuration from a remote computer, and have it display in a textbox.
Tag: PowerShell
Get DNS Name from IP Address
Get-NameFromIP.ps1 demonstrates two functions which I use frequently: Function Test-IsIP ($strTest) { [Net.IPAddress]::TryParse($strTest, [ref]$null) } and Function Get-HostName($IP) { Try { ([System.Net.DNS]::GetHostByAddress($IP)).hostName } Catch { Write-Warning “Not resolved” } } Together these provide you with a good way of testing IP input from user and natively resolving IP addresses to DNS hostnames.
Export AD Users
Export-ADUsers.ps1 is a GUI script which exports users with the attributes you select from any OU selected from a domain navigation menu. The list of available attributes are read from the Schema. There is special handling of some attributes and so it can return the domain, Enabled, userAccountControl and published certificates. Not required: admin rights…
Export Domain Group Members
Export-DomainGroupMembers.ps1 is a GUI script which exports group membership with the attributes you select. It takes the group’s distinguishedname as a parameter, and supports very large groups. How large? I have enumerated groups with over 350,000 members in a multidomain forest. You can get nested group membership, even if there are recursion loops. The list…
Get the most recent computer and user GPO Events from local or remote computer
Getting Windows Events can be painfully slow, but Get-WinEvent and a good filter can really speed things up. Get-GPOEvents.ps1, below, looks for the most recent cycle of user an computer GPO events found in in the Microsoft\Windows\GroupPolicy log. This data can be quite valuable in troubleshooting GPO issues. It works by looking for the user…
Get User Lockout Information
This script lets you see lockout events for a user from the domain controller on which the event(s) occurred. It accepts the user’s distinguished name as input, enumerates the list of domain controllers, then finds the LockoutTime on each domain controller. It then calculates the time +/- 2 seconds, and queries the DC event log…
Manage Device on Remote Computer / List Connected USB Devices
Remote access to the Plug and Play (PNP) RPC interface was removed in Windows 8, and since that time administrators have been unable to remotely manage Windows devices without RDP or a third party utility. I haven’t been a desktop support person in years, and only recently learned about this, when troubleshooting a workstation with…
Get Logon and Unlock Events from Windows Computer
It is faster to get events from the Security log locally then it is remotely. Get-LogonEvents.ps1 gets event 4624 using an XPath syntax query remotely executed with Invoke-Command: <# This is used to get interactive logon and unlock events from a remote PC Alan Kaplan, www.akaplan.com 4/14/2020 Public version 12/24/21 #> Param ( [Parameter(Mandatory =…
Get AD Replication Metadata
Some Active Directory attributes are local to the domain controller where the event occurred, such as lastlogon, but most others are replicated to all domain controllers within that domain. This should be distinguished from the attributes which are part of the Global Catalog – those attributes are a subset of domain attributes which exist and…
Find AD Object’s DistinguishedName
Getting the distinguishedname of an Active Directory object is a common administrative task. Find-ADObject_ps1 makes it easy to get this information for users, computers and groups using System.DirectoryServices.DirectorySearcher instead of the ActiveDirectory module. Admin rights are not required. The syntax is simple, ex: .\Find-ADObject.ps1 -adobject ‘MyGroup’ -ADObjectType Group.