PSEXEC,访问被拒绝错误

发布于 2024-07-19 18:49:06 字数 64 浏览 6 评论 0原文

当我使用 PSEXEC.exe 时,远程系统出现“访问被拒绝”错误。

知道如何解决这个问题吗?

While I'm using PSEXEC.exe getting 'Access denied' error for remote systems.

Any idea about how to solve this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(20

烟雨扶苏 2024-07-26 18:49:07

我有同样的问题。 经过一番努力,我找到了一个简单而完整的解决方案:

  1. 我使用 runas 在管理员帐户中运行脚本
  2. 我使用 psExec 中的 -s 参数 运行系统帐户
  3. 在 PsExec 内,我使用管理员帐户再次登录
  4. 您可以使用& 运行多个命令
  5. 请记住将 [USERNAME]、[PASSWORD]、[COMPUTERNAME]、[COMMAND1] 和 [COMMAND2] 替换为实际值

代码如下所示:

runas /user:[USERNAME] "psexec -e -h -s -u [USERNAME] -p [PASSWORD] \\[COMPUTERNAME] cmd /C [COMMAND1] & [COMMAND2]"

如果您想在另一台计算机上调试脚本,请运行以下模板:

runas /user:[USERNAME] "psexec -i -e -h -s -u [USERNAME] -p [PASSWORD] \\[COMPUTERNAME] cmd /C [COMMAND1] & [COMMAND2] & pause"

I had the same problem. And after a hard work, I found a easy and full solution:

  1. I use runas to run the script in a admin account
  2. I use the -s parameter in psExec to run in a system account
  3. Inside the PsExec, I login again with a admin account
  4. You can use & to run multiples commands
  5. Remember to replace [USERNAME], [PASSWORD], [COMPUTERNAME], [COMMAND1] and [COMMAND2] with the real values

The code looks like this:

runas /user:[USERNAME] "psexec -e -h -s -u [USERNAME] -p [PASSWORD] \\[COMPUTERNAME] cmd /C [COMMAND1] & [COMMAND2]"

If you whant to debug your script in the another machine, run the following template:

runas /user:[USERNAME] "psexec -i -e -h -s -u [USERNAME] -p [PASSWORD] \\[COMPUTERNAME] cmd /C [COMMAND1] & [COMMAND2] & pause"
守望孤独 2024-07-26 18:49:07

尝试在目标(远程)计算机上设置此键,然后重新启动计算机:

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System]
"LocalAccountTokenFilterPolicy"=dword:00000001

请参阅:http://forum。 sysinternals.com/topic10924.htmlhttp://www.brandonmartinez.com/2013/04/24/resolve-access-is-denied-using-psexec-with-a-local-admin-account/

Try setting this key on the target (remote) machine, and restart the machine:

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System]
"LocalAccountTokenFilterPolicy"=dword:00000001

See: http://forum.sysinternals.com/topic10924.html and http://www.brandonmartinez.com/2013/04/24/resolve-access-is-denied-using-psexec-with-a-local-admin-account/

眼眸里的快感 2024-07-26 18:49:07

我刚刚添加了“-с”参数。 它使 Psexec 副本可执行到远程计算机。 因此它可以正常工作而不会出现访问错误。

I just added "-с" parameter. It makes Psexec copy executable to remote machine. So it works without access errors.

随遇而安 2024-07-26 18:49:07

我发现 Sophos 一直将 psexec.exe 放入隔离区。 一旦我授权它,它运行得很好。

I found Sophos kept placing psexec.exe into the Quarantine section. Once I authorized it, it ran fine.

本宫微胖 2024-07-26 18:49:07

即使在 win 10 上,我仍然使用 psexec。将 Windows 10 的 win32 文件夹中的 psexec.exe 替换为旧版本即可工作 -> ; 我用的是2.11.0.0版本。 我使用的 Windows 10 版本仅在远程计算机上将 .bat 文件作为后台/隐藏进程运行。 花了一整天的时间才弄清楚这个问题。

将上面的注册表项添加到远程计算机也有帮助:

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

I still use psexec, even on win 10. Replace the psexec.exe in the Windows 10's win32 folder with the older version to work -> I use version 2.11.0.0. The Windows 10 version I was using would only run .bat files as background/hidden process on the remote computer. Took a whole day to figure this out.

Adding the registry key from above to the remote computer helps as well:

   reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\system /v LocalAccountTokenFilterPolicy /t REG_DWORD /d 1 /f
蓦然回首 2024-07-26 18:49:07

我遇到过 AV 隔离 Psexec 的情况 - 必须禁用按访问扫描

I had a case where AV was quarantining Psexec - had to disable On-access scanning

且行且努力 2024-07-26 18:49:07

我发现 PSEXEC(和其他 PS 工具)失败的另一个原因 - 如果某些东西(例如病毒或木马)隐藏了 Windows 文件夹和/或其文件,则 PSEXEC 将失败并出现“访问被拒绝”错误,PSLIST将给出错误“未找到处理器性能对象”,并且您将不知道原因。

您可以通过 RDP 进入; 您可以访问admin$共享; 您可以远程查看驱动器内容等,但没有迹象表明文件或文件夹被隐藏是原因。

我将在昨天仔细阅读的几个页面上发布此信息,同时试图确定这个奇怪问题的原因,因此您可能会在其他地方逐字地看到此信息 - 只是想在其他人拔出头发之前我会把这个词说出来从根源上试图理解为什么性能计数器与 PSEXEC 的运行有关。

I found another reason PSEXEC (and other PS tools) fail - If something (...say, a virus or trojan) hides the Windows folder and/or its files, then PSEXEC will fail with an "Access is Denied" error, PSLIST will give the error "Processor performance object not found on " and you'll be left in the dark as to the reason.

You can RDP in; You can access the admin$ share; You can view the drive contents remotely, etc. etc., but there's no indication that file(s) or folder(s) being hidden is the reason.

I'll be posting this information on several pages that i was perusing yesterday while trying to determine the cause of this odd problem, so you might see this elsewhere verbatim - just thought I'd put the word out before anyone else pulled their hair out by the roots trying to understand why the performance counter has anything to do with PSEXEC running.

一个人的旅程 2024-07-26 18:49:07

对于任何可能偶然发现这一点的人。 Microsoft Windows 最近(2013 年 12 月)在 Windows 7 上发布了一个安全更新,该更新阻止远程执行。
请参阅http://support.microsoft.com/kb/2893294/en-us

我通过转到控制面板\程序\程序和功能\已安装的更新来卸载安全更新,

此后它就可以正常工作。

For anybody who may stumble upon this. There is a recent (Dec 2013) Security Update from Microsoft Windows on Windows 7 that is preventing remote execution.
See http://support.microsoft.com/kb/2893294/en-us

I uninstalled the Security Update by going to Control Panel\Programs\Programs and Features\Installed Updates

It worked right after that.

花开雨落又逢春i 2024-07-26 18:49:07

以下方法有效,但只有在我将 PSEXEC 从 Microsoft 升级到 2.1 后才有效。

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System]
“LocalAccountTokenFilterPolicy”=dword:00000001 请参阅:
http://forum.sysinternals.com/topic10924.html

我有一个稍旧的版本,没有不工作。 我用它通过 Dell kace 做了一些 USMT 工作,工作很愉快:)

The following worked, but only after I upgraded PSEXEC to 2.1 from Microsoft.

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System]
"LocalAccountTokenFilterPolicy"=dword:00000001 See:
http://forum.sysinternals.com/topic10924.html

I had a slightly older version that didn't work. I used it to do some USMT work via Dell kace, worked a treat :)

往事风中埋 2024-07-26 18:49:07

在 Windows Server 2012 R2 上,我无法从用户帐户运行,

psexec -u administrator -p password \\machinename -h -s -d -accepteula cmd.exe

但如果不带参数 -h -s 运行,它就可以正常工作。 这就是为什么我用它来解决我的问题:

psexec -accepteula -u administrator -p password \\machinename %PathToLocalUtils%\psexec.exe -h -s -d  cmd.exe

On Windows Server 2012 R2 I had trouble to run from user account

psexec -u administrator -p password \\machinename -h -s -d -accepteula cmd.exe

But it works fine if you run without parameters -h -s. That's why I use this to solve my trouble:

psexec -accepteula -u administrator -p password \\machinename %PathToLocalUtils%\psexec.exe -h -s -d  cmd.exe
鯉魚旗 2024-07-26 18:49:07

除非禁用了 UAC,否则我无法访问远程计算机。

这必须在本地完成,可以从控制面板或通过 cmd 运行以下命令:

reg.exe ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v EnableLUA /t REG_DWORD /d 0 /f

启用 UAC 时,请确保以管理员身份运行 cmd >。

I couldn't get access to remote machines unless I had UAC disabled.

That has to be done locally, either from control panel or running the following through cmd:

reg.exe ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v EnableLUA /t REG_DWORD /d 0 /f

While UAC is enabled, make sure you run cmd as administrator.

漫雪独思 2024-07-26 18:49:07

对于不同的命令,我决定将网络从公共网络更改为工作网络。
再次尝试使用 psexec 命令后,它再次工作。
因此,要使 psexec 正常工作,请尝试将网络类型从公共网络更改为工作或家庭网络。

For a different command I decided to change the network from public to work.
After trying to use the psexec command again it worked again.
So to get psexec to work try to change your network type from public to work or home.

春夜浅 2024-07-26 18:49:07

我尝试了很多方法,但无法使用psexec。 它给出“访问被拒绝”。 将目标用户帐户类型从标准更改为管理员后,我通过 psexec 连接计算机。

我研究了需要管理员类型帐户的原因,然后发现 此答案。

您可以通过以下方式更改目标计算机用户帐户:控制面板 -> 用户帐户 -> 更改帐户类型。 如果您登录的是标准帐户,则必须输入管理员帐户和密码才能更改该帐户。

之后,我使用以下命令登录: psexec \\remotepcname -u remoteusername -p remotepassword cmd

I tried a lot of way but I could not use psexec. It gives "Access denied". After I change the target user account type from Standard to Admin, I connected the machine via psexec.

I researched the reason why admin type account is required then I found this answer.

You can change target machine user account this way: Control Panel -> User Accounts -> Change Account Type. You must enter an admin account and password to change that account if you logged in standard account.

After that I logged in with this command: psexec \\remotepcname -u remoteusername -p remotepassword cmd

胡大本事 2024-07-26 18:49:07

尝试了上述所有建议,但仍然无法解决该错误。 最后,一旦我进行了以下更改,我就可以成功运行 PSexec 命令。

事实证明,当您启用 UAC 时,psexec 无法按预期工作。 我们需要将 HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\EnableLUA 设置为 0,然后 psexec 开始按预期工作。

Tried all suggestions above, but still was unable to resolve the error. Finally once I made the below change, I could successfully run the PSexec command.

Turns out that when you have UAC enabled psexec does not work as supposed. We need to set HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\EnableLUA to 0 then psexec starts working as expected.

灯下孤影 2024-07-26 18:49:07

这是问题的答案,

请确保您的系统执行策略已设置

远程签名

使用 get-ExecutionPolicy 验证它

,然后运行命令

在此处输入图像描述

winrm qc 命令和提示符 y

就是这样。

Here is the answer of the issue

make sure your system execution policy is set

RemoteSigned

verify it using get-ExecutionPolicy

after that just run the command

enter image description here

winrm qc command and prompt y

thats it.

你丑哭了我 2024-07-26 18:49:06

您好,我在这里总结了许多在线来源的“访问被拒绝”的各种解决方案:
大多数信息可以在这里找到(包括所需的要求) - sysinternal 帮助

  1. 正如有人提到的添加此注册表项,然后重新启动计算机:

    <块引用>

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

    阅读这篇知识库文章了解其作用及其原因是
    需要

  2. 禁用防火墙(注意 - 这将使您没有任何防火墙
    保护)

    <块引用>

    netsh advfirewall 将所有配置文件状态设置为关闭

  3. 如果目标用户有一个空白密码并且您不想添加一个,请在目标上运行:

    <块引用>

    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa]
    "LimitBlankPasswordUse"=dword:00000000

  4. 这对我不起作用,但我在一些地方读过它对其他人有用,
    在目标上执行:

    <块引用>

    开始-> 运行-> secpol.msc-> 当地政策 -> 安全选项-> 网络访问:共享> 和本地帐户的安全模型> 经典 - 本地用户以自己的身份进行身份验证

    如果已经处于“经典”状态:

    <块引用>

    移动到“仅限来宾 - ..”从提升的命令提示符 gpupdate \force 运行
    移回“经典 - ..”,再次从提升的命令提示符 gpupdate \force 运行

  5. 这解决了我的问题:

    <块引用>

    从提升的命令提示符“net use”在目标上运行,查看输出图表以及远程列中列出的共享(我只删除了断开连接的共享 - 您可以全部尝试)运行“net use [之前列表中的远程路径” ] /delete”然后运行 ​​'net use \target\Admin$ /user:[用户名]' 输入提示密码请求(如果空密码只需按 Enter 键),viola 应该可以工作。

Hi i am placing here a summary from many sources online for various solutions to "access is denied" :
most information can be found here (including requirements needed) - sysinternal help

  1. as someone mentioned add this reg key, and then restart the computer :

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

    Read this knowledge base article to learn what this does and why it is
    needed

  2. Disable firewall (note - this will leave you with out any firewall
    protection)

    netsh advfirewall set allprofiles state off

  3. if target user has a blank PW and you dont want to add one, run on target:

    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa]
    "LimitBlankPasswordUse"=dword:00000000

  4. This didnt work for me, but i have read it did for others in a few places,
    on target execute:

    Start -> Run -> secpol.msc -> Local Policies -> Security Options -> Network Access: Sharing > and security model for local accounts > Classic – local users authenticate as themselves

    if already in 'Classic':

    move to "Guest only - .." run from elevated command prompt gpupdate \force
    move back to 'Classic - .." again run from elevated command prompt gpupdate \force

  5. This one solved my issue:

    run on target from elevated command prompt "net use" look at ouput chart and for shares listed in remote column there (i only deleted the disconnected ones - you can try them all) run "net use [remote path from before list] /delete" then run 'net use \target\Admin$ /user:[user name]' enter prompt password request (if empty PW just press enter), viola should work.

芯好空 2024-07-26 18:49:06

我刚刚解决了相同的症状,方法是创建注册表值 HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\system\LocalAccountTokenFilterPolicy 并将其设置为 1。更多详细信息请参见此处

I just solved an identical symptom, by creating the registry value HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\system\LocalAccountTokenFilterPolicy and setting it to 1. More details are available here.

晨敛清荷 2024-07-26 18:49:06

对我的情况有帮助:

cmdkey.exe /add:<targetname> /user:<username> /pass:<password>
psexec.exe \\<targetname> <remote_command>

This helped in my case:

cmdkey.exe /add:<targetname> /user:<username> /pass:<password>
psexec.exe \\<targetname> <remote_command>
初心 2024-07-26 18:49:06

PsExec 拥有其启动器拥有的任何访问权限。 它在常规 Windows 访问控制下运行。 这意味着启动 PsExec 的人(无论是您、调度程序、服务等)在目标计算机上没有足够的权限,或者目标计算机配置不正确。 首先要做的事情是:

  1. 确保目标计算机熟悉 PsExec 的启动器,可以通过域,也可以在两台计算机上本地定义相同的用户和密码。
  2. 使用命令行参数指定目标计算机已知的用户(-u 用户 -p 密码)

如果这不能解决您的问题,请确保目标计算机满足最低要求,此处指定

PsExec has whatever access rights its launcher has. It runs under regular Windows access control. This means whoever launched PsExec (be it either you, the scheduler, a service etc.) does not have sufficient rights on the target machine, or the target machine is not configured correctly. The first things to do are:

  1. Make sure the launcher of PsExec is familiar to the target machine, either via the domain or by having the same user and password defined locally on both machines.
  2. Use command line arguments to specify a user that is known to the target machine (-u user -p password)

If this did not solve your problem, make sure the target machine meets the minimum requirements, specified here.

前事休说 2024-07-26 18:49:06

在使用 psexec 之前,您可以尝试使用命令

net use \\computername\ipc$ /user:adminname password

来获取远程 PC 上的管理员权限。

You can try the command

net use \\computername\ipc$ /user:adminname password

to get admin permissions on remote PC before use psexec.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文