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