My Scenario: I am running the pushd command to run searches on remote domain computers. However the search performs very slow/or not at all when a user is not logged on to the machine(machine is still powered on.)

I was wondering if it is possible to pass log in credentials with the pushd command. If not what are some alternate choices?

I cannot use other software or packages such as PsExec.

link|improve this question

For those who read this and think it to be nonsense (the pushd command having no search mechanism and having nothing to do with searching), I recommend reading harper89's other question for context. harper89, write precisely what you are actually doing in questions, not some confused outline that people won't understand. – JdeBP Jun 14 '11 at 13:02
I am searching remote computers once I use pushd to "connect" to them. – harper89 Jun 14 '11 at 13:09
I think he's using it to connect to remote systems and checking versions of installed executables, such as java. – Darth Android Jun 14 '11 at 13:58
Out of pure curiosity, I still wonder why PsExec is not available when alternate choices are being asked for-- it's a Microsoft utility, with the only difference between it and pushd being that it's not shipped by default... – Darth Android Jun 14 '11 at 14:11
these commands are being worked into an application and PsExec would involve another possible download for the end user or machines that will be running the application. – harper89 Jun 14 '11 at 16:26
show 1 more comment
feedback

1 Answer

up vote 2 down vote accepted

You can use:

net use \\RemoteComputer\c$ password /user:MY_DOMAIN\remoteUsername
"\\RemoteComputer\c$\Program Files\Java\jre6\bin\java" -version"
net use \\RemoteComputer\c$ /d

(Edited to add simplifications from grawity from comments. Learn something new every day!)

link|improve this answer
FWIW, you don't need to specify a drive letter for net use -- just passing path/user will cause Windows to connect and authenticate. Although pushd will create a drive letter anyway -- but it's not always needed; most programs will accept \\remotecomputer\C$ just fine. – grawity Jun 14 '11 at 18:58
@grawity: You mean net use \\computer <credentials> and then \\computer\path\executable -arg will work as expected? – Darth Android Jun 14 '11 at 19:07
Yes, that's right. (To disconnect, net use \\computer\IPC$ /d.) – grawity Jun 14 '11 at 19:10
One correction to your edits: If you specify a share name when connecting, you must specify the same when disconnecting too. It's only bare \\computer (as in your comment) that gets translated to \\computer\IPC$. – grawity Jun 15 '11 at 7:33
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.