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.

  • 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. – sealz 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. – sealz Jun 14 '11 at 16:26

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!)

  • 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. – user1686 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.) – user1686 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$. – user1686 Jun 15 '11 at 7:33

I would use this command to map a drive. This guarantees that connection will persists and you have a drive name mapped to E: so you can just call that drive name to run commands.

Net Use  E: \\server\share my_password /user:username  /persistent:MY_DOMAIN/username /y

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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