How to Impersonate in Powershell
PowerShell has various properties and parameters set for each object it contains. It even has a parameter for the Get-WmiObject where you can impersonate a user. In this tutorial, you will get acquainted with the ImpersonationLevel parameter in PowerShell.
If you have not already done so, click open Windows PowerShell. Remember, in order to run scripts and various commands, you must run PowerShell as the administrator.
There are five level values that one may choose from for impersonation. The command is quite simple, you need the system to get WmiObject, name space and have the appropriate settings applied. An example of this command is as follows:
Get-WmiObject "Namespace root\cimv2 "Class Win32_Process "Impersonation 3 "ComputerName Computer_B
You must be an administrator in the system you are using to do the impersonation, otherwise, the command will only print out an error.
As previously stated there are five different levels of impersonation. The levels are listed in the table below by level number.
||Uses the default value of the remote host.
||Hides your credentials from the WMI Provider
||Enables WMI objects to query for your credentials. Default for WMI pre-version 1.5.
||Enables WMI objects to use your credentials when running, thereby impersonating you. This level is the default for WMI version 1.5 or the later.
||Lets WMI objects impersonate you and additionally use your credentials to access other objects on other systems.
A Few Last Words!
There are various applications to today’s lesson, keep in mind, in order to impersonate, you must have administrative privileges. So you still need permission. Thank you for being a valued reader. Join us next time for additional Windows PowerShell tutorials! Till thenâ€¦