windows batch file to call remote executable with username and password - windows

Hi I am trying to get a batch file to call an executable from the server and login. I have a monitoring program that allows me send and execute the script. OK here goes....
//x3400/NTE_test/test.exe /USER:student password
Now this doesn't work. The path is right because when I type it in at the run menu in xp it works. Then I manually login and the script runs. How can I get this to login and run that exe I need it to?
Part 2:
Some of the machines have already logged in with the password saved (done manually). Should I have a command to first clear that password then login?
Thanks for any replies, I appreciate the help
Jake

(note: this question probably belongs on serverfault.com or superuser.com)
If the login that needs to happen is the login for the network share, you can have your script do that using the net use command:
net use //x3400/NTE_test /USER:student password
//x3400/NTE_test/test.exe
If the login is something specific to the ``test.exe` program, then you'll have to find out from its documentation how to pass credentials on the command line.
In either case, you need to consider the security implications of having a user's password in a script. If the user is has an account with the same name and password on the x3400 server as on the machine he's running on (or if the x3400 machine is in the same domain as his machine), there should be no need for him to provide credentials. This might be a better way to handle the password.

Related

passing username/password to openVPN CLI directly

I want to make a script that asks the user for username and password and uses these for a few things at once, including connecting to OpenVPN without needing to either
store the password on the disk
ask the user for the data many times over
for example you can run net use with user and password to mount shares, however openVPN seemingly only has an option to pass a file with username and password.
On Linux there seemingly are solutions like this, however I don't seem to find anything similar for windows yet.
Is there a solution?

Possible to use net user and get information about username on another domain?

I am wondering if it's possible to use the 'net user' command in Windows to pull up details on a user in a different domain? The domain is connected to us. For example, I can log in as that user in the other domain from the same network.
This is the net user command I use to pull my local details:
net user myusername /domain
Is there a way to specify a different domain name? Or are there other commands that will do something similar? I'm am wanting to use a command to verify the password expiration date on the other domain.
No, you cannot use it that way. The /domain flag is used just for specifying that the command should be run on the primary domain controller for the domain that you are in. Otherwise, the command runs on the computer (server) where you are running the command.
https://support.microsoft.com/en-us/help/251394/how-to-use-the-net-user-command
You can, however, use PowerShell cmdlets to manage users in Active Directory. The following documentation is for the Get-AdUser cmdlet.
https://technet.microsoft.com/en-us/library/ee617241.aspx
You probably want to pass in the Identity flag and specify the full Distinguished Name for the user object. For example: -Identity "CN=SaraDavis,CN=Europe,CN=Users,DC=corp,DC=contoso,DC=com"
Try to issue following command in powershell
Get-ADUser "username" -Server "domaincontroller.localdomain"
You can log onto a virtual machine or windows server on that domain and run the same command to get that domain user's details.
Powershell like in Matson's answer is probably the better option if you rarely have machines open on that domain, but if you are already working on a machine in that domain your command works just fine.

Getting mail on windows logon with username of logged-in user

I am trying to create action task that will send mail when anyone logs in to a particular system with username of a logged in user.
I am very new to this task since I never worked as a system admin anytime.
What I think I should do is to specify a program to execute when log-in event occurs, but am not aware of what sort of program I should. I thought it should be exe file.
Q. Can I specify vbs file?
Q. If yes what should be the content of vbs? Is there any ready made script available for accomplishing the same?
Q. Also not sure where to specify it. Is this below screen where I can specify it:
Q. Also this I am trying to do on windows 7 which is in network with AD configured on Windows Server 2008. So where should I specify the action? on server or on this particular Win 7 machine?
If u have AD, you can use logon scripts (*.cmd | *.vbs) and specify it for each clients.
To send email by the command line, try to use smth like telnet smtp.gmail.com 25/465.

Need to FTP windows server without user access

I am able to access the server ftp:// 172.155.58.78/Util in browser where my reports are present. I am able to right click and download them.
However I want to automate the FTP of these report files. So I tried to FTP through CMD prompt, this is asking me for the user/pass which I do not have.
Is there any work around for this?
Your browser probably supplies the FTP server with the default anonymous account credentials, without you knowing it.
Try to login from your cmd with username anonymous and no password, or use your e-mail address as your password.

is it safe to call "plink.exe" in an application

i want to use "plink.exe -u username -pw securepassword" on my windows visual c++ program.
will username and password remain safe while calling this command? I mean can a hacker steal or sniff the username and password? (consider hacker can't get to the password directly from the exe file)
Use SSH Keys so your program does not have to use a password directly. Even if the hacker can sniff the username, a strong password should prevent an attack.
If I had access to plink.exe (presumably running on the local box) then I could replace it with a Trojan version that logged your user/pass - but still otherwise worked as normal. Its potentially a bad idea, but then again, if I have access to the box then all bets are off.
Does the hacker somehow have access to memory but not the executable? He could certainly pull it from memory, but it's hard to know what security problems you're facing without knowing the actual situation

Resources