Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

psexec problem on 64bit target systems

Posted on 2010-08-23
5
Medium Priority
?
1,613 Views
Last Modified: 2012-05-10
Dear All,
Lately I've been using PsExec. I use it to copy some NSIS exe installers to remote machines and execute them. The default remote path of these installers seems to be %windir%\system32. Is there a parameter available to change this to something else?

I ask because on 64bit Windows systems you can't execute NSIS installers from the system32 directory, it will throw an error.

Any advice would be greatly appreciated! Thanks a bunch.
0
Comment
Question by:carlettus
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 3

Expert Comment

by:Dave_LaSalle
ID: 33501554
try -w C:\WINDOWS\SysWOW64
0
 

Author Comment

by:carlettus
ID: 33501791
I've tried it with w but this is related to the process directory , not the executable.
The installer still gets copied on system32
thank you
0
 
LVL 3

Expert Comment

by:Dave_LaSalle
ID: 33501922
You may need to batch for this but try to put the syswow64 folder into the path statement before the system32 entry.

try set PATH=%systemroot%\SysWOW64;%PATH%
this will be temporary
0
 
LVL 71

Accepted Solution

by:
Qlemo earned 2000 total points
ID: 33508645
If you use the -c option, the file will always be copied into the real system32 folder, as the PsExec service runs in native mode (i.e. 64bit). You need to run a script, checking if running on x64, and then changing the working dir before copying and running anything else:

@echo off
if exist %WinDir%\Sysnative cd /d %WinDir%\SysWow64
copy \\server\share\NSIS.exe .
NSIS.exe

Start this script without copying:

psexec \\remotePC cmd -c \\server\share\instNSIS.cmd
0
 

Author Closing Comment

by:carlettus
ID: 33529547
It's working great.
thank you.
0

Featured Post

PowerShell Core for Advanced Linux Administrators

Understand advanced principals around Powershell Core with a focus on the Linux Administrator.  This course covers how to administer numerous environments across multiple platforms including Linux, Azure, AWS, and Google Cloud from a single shell instance.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question