psexec

Running a program on a remote machine as part of continuous integration

We use TeamCity, nant and psexec to run a command on a remote machine as part of the release packaging. Everything works fine when I run the nant from the console but when running from teamcity psexec hangs (freezes) 50% of the times. I looked through many forums and there seems to be workarounds that increase complexity of the call and ...

Psexec not outputting to log file in VB script

Hi all, I have a VB script which needs to run psexec to launch an app called md5 on a remote server. Md5 generates a hash key of a file and takes one parameter - the file path\name. I need to retrieve the has key that is generated to store in a variable. Below is the code I am using: Set objShell = CreateObject("Wscript.Shell") strcomp...

Remote and automated IIS 7 management from build server - permissions issue

Here's the scenario: Win2003 Build Server (CCNET) IIS7 target deployment server The various MSBuild tasks (Sdc.Tasks, MSBuild Community, MSBuild Extension Pack) for doing this (creating VDirs, setting AppPool properties) are not suitable for at least one or more of the following reasons: No support for IIS 7. No possibility to pass...

PowerShell script - How to process result of executed command

I have a small script that copies files to a list of remote machines. In this script I use: Copy-Item "$AppLocation\$AppName" -destination "\\$MachineName\c$\" -force This can throw various types of errors. If this throws an error, I want to log the error to a file and then continue. My question is that I'd like to know what would be...

Help needed to get Process ID for PsExec.exe in C# ??

Hi, I am using the below code to invoke PsExec.exe which invokes my console application in two servers, I am not able to grab the ProcessId of the invoked processes (my console apps). process.StandardOutput.ReadToEnd()); is only giving me the servernames but not the complete content. Can you please help me to get the process id's ge...

Running batch file on remote machine from hudson server using PSEXEC

I am new to Hudson with PSEXEC, i am using hudson in my computer, i want to run batch file on remote computer from hudson build. I used PSEXEC to run batch file on remote computer,when i executed from command promt it working successfully.But same i did from Hudson build its hanging..it's not doing anything.so please give any suggestions...

executing a process on a remote machine with sysinternals psexec

Hi there I'm working on an Asp.net\c# application I'm trying to execute a process in a remote machine using system.Diagnostics.process and sysinternals psexec here's my code example ProcessStartInfo startInfo = new ProcessStartInfo("psexec"); startInfo.Arguments = string.Format(CultureInfo.CurrentCulture, @"\\machineNAme c:\someDir...

How to check remote server time via psexec

I tried command like below. But can't see server time. psexec \\SERVER_NAME -i -u USERNAME -p PWD "C:\WINDOWS\system32\cmd.exe /c time /t" Or is there any alternative? Thanks. ...

Using PSExec from within CruiseControl .NET

Hi All, I'm trying to call a PSExec task from CC.NET and running into some difficulties. Here's the CC project <project name="Test"> <tasks> <exec> <executable>C:\Utilities\psexec.exe</executable> <buildArgs>-u [UNAME] -p [PWD] "C:\Utilities\Joel.bat"</buildArgs> </exec> </tasks> </project> Here's the sourc...

psexec failing with return code 122 when used from Windows service

I've written a WCF service as a wrapper around a C# utility we've written that uses the SysInternals psexec utility to run jobs on a remote system. psexec is invoked from C# with command-line parameters that specify the domain, user and password to use. All works fine when I invoke the C# utility from PowerShell locally. However, when ...

psexec premissions

Hey, I wrote a c# program to run a remote exe using Psexec.exe via domain-admin user - works fine via loca-admin user - 'access denied error' you know what could solve this? ...

Using psexec to start Internet Explorer then navigate to a particular URL

Just like the question says, I want to be able to use psexec to start Internet Explorer, then load a particular website in the browser. I know how to start IE, just can't make a command that goes to a particular webpage. This is what I have so far: psexec "C:\program files\Internet Explorer\iexplore.exe" I just can't figure the syntax ...

How do I capture errors from psexec?

I'm trying to restart a significant number of windows computers on different domains, using the same local admin credentials that work across domains. psshutdown.exe -r -f -t 600 -e p:0:0 -m "This reboot is a scheduled weekly reboot." -u "admin username" -p adminpw @mon.txt 1>4-26-mon.log 2>&1 Honestly, I just want to log the ones th...

Psexec , cmd and batch file

Hello. I have a batch file named a.bat on a winserver2008 Desktop. That batch file only write the SessionID (from environment variable) to a local eventlog. I want to execute it remotely using cmd (otherwise the SessionName doesn't appear). so I have tried c:\PsTools\psexec.exe \\<Server> -u test2 -p <Password> -i 2 cmd "c:\Users\te...

Psexec "run as (remote) admin"

Hi, I wrote some c# code that uses PSexe. I want it to run a remote exe on a machine connected to my LAN. That exe creates a new local user. When I run that exe locally on the remote machine (after right click --> "run as Admin") - it works fine. I don;t know how to simulate the right click --> "run as Admin" from Psexec. I have tried ...

psexec c# to start remote process not working

I am trying to kick off a bunch of processes on a remote computer connected to my LAN. I had code working to do the same thing on a local computer. However, that API didn't allow me to do this. for (int k=1;k<=iterNum;k++) { argumvar="-c -i "+sourcePath + Convert.ToString(k) + "\\myProgram.exe /r "+sourcePath+Convert.ToString...

PSExec never completes when run inside start-job

I'm trying to execute a cmd file on a list of 48 computers. I don't want to execute and wait for completion sequentially because each cmd takes about 10 minutes to complete. WinRM isn't an option. Neither is WMI. PSExec is an option....but I can't seem to make it work inside of Start-Job. I'm doing something like: $sb = { param...

Nant - Check if a remote share already exists

We are using Nant to deploy an application and need to ensure that a share is created during the process. We use psexec and net share to create the share but this fails and stops Nant if the share already exists. Is there any way to detect that a share exists already? Either before trying to create the share or being able to detect t...

Set MSMQ permissions using VBScript (via Nant)

We are using Nant to deploy an application and need to create some MSMQ Queues during the process. We use Nant/psexec/cscript to call a VBScript to create the queue itself but we also need to set the permissions. Can this be done programmatically? I am aware of Setting permissions on a MSMQ queue in script however that question asks ...

How to get Currently logged user's session ID?

I'm running a process from inside a windows service using ProcessStartInfo processStartInfo = new .... Process.Start(processStartInfo); The problem is, if I run service under local system account, it runs alright, but it doesn't show the programs' window. I've tried to put user credentials in service properties, but then 'Allow serv...