PSEXEC将复制.bat文件,但不会在远程计算机上运行它?

时间:2015-07-29 05:47:43

标签: windows batch-file psexec

我已经环顾了一下,但似乎无法找到答案。 我正在创建一个脚本,它是我们公司的登机过程的一部分。作为该过程的一部分,它授予另一个用户访问现有用户配置文件共享的权限(工作正常)。下一部分将远程映射网络驱动器(我遇到了麻烦。我正在使用PSEXEC发送一个映射用户驱动器的bat脚本:

    @echo off
::Welcome note
echo Welcome to the User EXIT script!
:Start

:: set variable to be used throughout script for the username of the person exiting.

set /p uname="Please enter the username for exit:"
set /p cleanupu="Please enter the username for homedrive & mailbox cleanup:"
set /p computermap="Please enter the Computer to clean up the Homedrive:"
echo The username for exit is: %uname%
echo The username that is cleaning up is: %cleanupu%
echo The computer for the homedrive to be mapped to is %computermap%
set /P c=Is this correct [Y/N]?
if /I "%c%" EQU "Y" goto :init_confirm
if /I "%c%" EQU "N" goto :start

:init_confirm

::confirmation....

echo This script will exit the user: %uname%
pause
icacls "\\server\home$\%uname%" /grant DOMAIN\%cleanupu%:(OI)(CI)F
pause
echo net use z: \\server\home$\%uname%\ > map_temp.bat

psexec \\%computermap% -c -i -d map_temp.bat

pause
exit

这会将文件复制到远程计算机并打开一个空白的命令提示符窗口。

任何人都可以看到为什么这实际上不会运行map_tem.bat?

欢呼声

0 个答案:

没有答案