Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Grab current user password

Status
Not open for further replies.

TheNewOne

Technical User
Mar 27, 2004
117
SI
Hi forum. I wonder IF it is possible to grab curent user password and put it into a strig. I know that you can grab, username, domainname, computername.

my enviroment:
-2 separated domains with no trust only DNS name resolving exist.
-users login t domain 1, their mailboxes and homefolders are in domain2
-users have same usernames in 1 and 2 domain, password is allso synchronized, same in 1 as it is in 2 domain

my problem:
-I would like that user who login in 1 domain script will check if he has allready activated homefolder in 2 domain, if folder does not exist, then script create and shate folder and set NTFS permissions vith CALCS
If homefolder exist than script just map H drive to user and quit

My script temporary looks like this, but give me error Unable to logon, bad username or password. can someone there help me. I hope some of those excelent guys there PHV, tsuji,markdmac, mrmovie, could give me some advice how to script my problem. THX

Dim objNetwork, objFSO, strUserName, objFolder
Set objNetwork = CreateObject("Wscript.Network")
Set objFSO = CreateObject("Scripting.FileSystemObject")
strUserName = objNetwork.UserName
If objFSO.FolderExists("\\server\c$\HomeDir\" & strUserName) Then
Set objFolder = objFSO.GetFolder("\\server\c$\HomeDir\" & strUserName)
Else
Set objFolder = objFSO.CreateFolder("\\server\c$\HomeDir\" & strUserName)
End If


Sub CreateShare( strComputer, strFolder, strShareName )
Dim strObject, objPrintJobSet

Set objWMIShare =GetObject("winmgmts:{impersonationLevel=impersonate}!//" & strComputer &"/root/cimv2:Win32_Share")

objWMIShare.Create strFolder,strShareName,0

Set objWMIShare = Nothing

End Sub


Dim strComputer, strFolder, strShare
Do
strComputer = "server"
Loop until strComputer <> ""
Do
strFolder = "c:\HomeDir\" & strUsername
Loop until strFolder <> ""
Do
strShare = strUsername
Loop until strShare <> ""
CreateShare strComputer, strFolder, strShare



 
Upssss. where ware my brains, when I write this thread. It is inpossible I know. Maybe someone know some other solution for my big big problems. THX
 
Your best solution is to enable a trust between the domains. That way the user credentials (including password) can be used on Domain 2. You can then use script with XCACLs to assign rights to the folders you want by specifying both domain an username in the format domain\username.

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
 
THX fo your reply markdmac. Domain trust , isn't an option. There are some higher reasons then IT reasons. What about authenticating to fileserver's IPC$, or some local accounts??
...hmmmmm isn't good idea, a???.....
 
About the only thing I can think of that you could do would be to create your own user setup process where the user sets their password and you grab that password to be used on the other domain.



I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
 
Thx for your reply again. I don't understand what you mean with "create your own setu process where the user sets their password and you grab that password to be used on the other domain."

I'm trying now with NET USE \\TARGET\IPC$ "" /USER:"". With this command you could see all shares on server wich is in other domain. This is dead end i think.
 
I am suggesting that you create a web page with a form. Have it automatically detect the user name. Provide a change password box and use LDAP commands to reset the user password. Since you will have the password you can then pass that to the other domain to do any of the following;

1. Create an ID on the other domain
2. Set password to match on the current domain
3. Create the user folder and share if not already done

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top