Wednesday, September 8, 2021

Get A List of Domain Controllers

 Here is an easy way to pull a list of all the domain controllers in your environment using powershell.

Get-ADDomainController -filter * | Select-Object name | format-table

Wednesday, April 7, 2021

Find the RDS Licensing Server

 If for some reason you find yourself in an environment you don't know and need to find where a service such as the RDS licensing server is running you can run the following command.  The Format-List is optional, but I like to use it to make the output easier to read.

Get-ADObject -LDAPFilter "(&(CN=TermServLicensing)(objectClass=serviceConnectionPoint))" | Format-List

Friday, March 12, 2021

Use Powershell to Create A File

Sometimes you need to create a file in a directory for testing.  Here is a simple way to create an empty file in the current directory using powerhell.

New-Item newfile.txt -ItemType file

If you want to create the file in a different directory you can specify the path.

New-Item c:\directory\newfile.txt -ItemType file

Tuesday, March 31, 2020

Find a logged-in user remotely using PowerShell

There are numerous different reasons you may need to find out who is logged-in to a remote computer.  For example, say your firewall logs show a machine is doing something out of the ordinary, it might be a good idea to quickly figure out who is using it.

Here is a quick way to find out who that user is using Powershell.

get-wmiobject -ComputerName <computername> -Class Win32_ComputerSystem | Select-Object UserName

Thursday, September 12, 2019

Get MD5 checksum with PowerShell

To get the MD5 hash of a file using PowerShell use the following command. Get-FileHash <filepath> -Algorithm MD5