10

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.

6
  • 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, 2011 at 13:02
  • I am searching remote computers once I use pushd to "connect" to them.
    – sealz
    Jun 14, 2011 at 13:09
  • I think he's using it to connect to remote systems and checking versions of installed executables, such as java. Jun 14, 2011 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... Jun 14, 2011 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, 2011 at 16:26

2 Answers 2

11

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

4
  • 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. Jun 14, 2011 at 18:58
  • @grawity: You mean net use \\computer <credentials> and then \\computer\path\executable -arg will work as expected? Jun 14, 2011 at 19:07
  • Yes, that's right. (To disconnect, net use \\computer\IPC$ /d.) Jun 14, 2011 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$. Jun 15, 2011 at 7:33
1

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .