This post is in response to me thinking that people may be wondering how to use Chocolately, as discussed in “Getting Started with Chocolatey”, to install applications to a remote Windows 7, 8 or 10 computer.
The quickest solution is to utilize PsExec’s remote command prompt feature.
If you are in a workgroup environment rather than a domain environment you will most likely need to make a registry modification in order to be able to connect to a remote computer using PsExec.
Note: All registry edits should be performed with care. A backup of the registry is highly recommended before performing any registry edits.
Navigate to the following location in the Windows registry:HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\Current Version\Policies\System
• Right click.
• Choose New -> DWORD (32-bit) value.
• Change of the name of the newly created key to: LocalAccountTokenFilterPolicy
• Double click on the newly created key and change the value to: 1
Modifying the above registry setting allows full credentials to be passed between the local and the remote computers in a workgroup environment. I do not have access to a domain environment where I can test whether this registry modification is necessary in a domain environment or not. Please feel free to comment if you have the answer to this.
If you do not already have PsExec installed onto your own computer you can easily do so via Chocolatey using the following command: choco install sysinternals -y
Once you have installed the Windows Sysinternals suite you can open an admin command prompt and enter the following command: psexec \\REMOTECOMPUTERNAME cmd
If this is your first use of PsExec you will be prompted to accept the license agreement.
If your local credentials match the credentials of an account on the remote computer that has administrator credentials you should be connected without any problems. If your local account is different than your account on the remote computer that has administrator credentials you will have to enter a different command to connect remotely: psexec \\REMOTECOMPUTERNAME -u USERNAME cmd
If PsExec is able to successfully connect to the remote computer you should be prompted for the password of the user account that you specified. If the remote logon is successful you will be taken to a remote command prompt. You can issue the same commands here as if you were sitting directly in front of the computer. You can use this to install software via Chocolatey as discussed in the previous post.
To confirm that you are on another computer you can issue the command hostname
When you have finished you can enter exit and you will be returned to your local command prompt.