Tomgate
Tomgate

Reputation: 53

Psexec randomly Access denied

For Purpose, I use Pstools to remote the target PC to switch different WIFI profile in a batch file. The code be like:

psexec \\targetPC IP -u account -p password cmd.exe/c netsh.exe wlan add profile ....
#do something(cost about 5 hours to finish)
psexec \\targetPC IP -u account -p password cmd.exe/c netsh.exe wlan delete profile ....

i used to run this script at my pc smoothly & fine. but recently after I finish my testing, i got the error:

Couldn't connect to target PC IP, access is denied.

i have do some several test like:

psexec \\targetPC IP -u account -p password cmd.exe/c netsh.exe wlan add profile ....
timeout 600
psexec \\targetPC IP -u account -p password cmd.exe/c netsh.exe wlan delete profile ....

sometimes work fine, sometimes got access is denied. Is there any suggestion to solve this issue? thanks.

Note: I used to use psexec command to open calc or notepad on target PC, but recently i cannot, is that relate to Administrator or what?

Upvotes: 0

Views: 3248

Answers (1)

ori6151
ori6151

Reputation: 592

Did you run CMD as administrator? if no, run it as adminstrator. if yes, add this registry key:

reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\system /v LocalAccountTokenFilterPolicy /t REG_DWORD /d 1 /f

On Windows 7/8/10, UAC is enabled by default and is set to filter a network logon of a local account of their Administrative rights.

Upvotes: 1

Related Questions