• Announcements

    • xper

      MSFN Sponsorship and AdBlockers!   07/10/2016

      Dear members, MSFN is made available via subscriptions, donations and advertising revenue. The use of ad-blocking software hurts the site. Please disable ad-blocking software or set an exception for MSFN. Alternatively, become a site sponsor and ads will be disabled automatically and by subscribing you get other sponsor benefits.
Sign in to follow this  
Followers 0
mojoxp

Access network share with alternate credentials

5 posts in this topic

I've got a computer here that needs to go into a conference room and be logged in all the time. That's easy. The catch is that it needs to be able to access the central domain network share using a given users permissions from a desktop shortcut. That user needs to be able to quickly get access to their files and open them on the computer without logging directly into the machine. I've tried doing this with both RUNAS and CPAU, and they work but the problem is that they must copy over the user's profile in order to do so... which won't work for this situation. So what I need to figure out is how to have the user be able to click a link on the desktop and it will accept their credentials and then open the network share using those without having to load the profile over.

Any ideas?

0

Share this post


Link to post
Share on other sites

Sounds like you may be trying to overcomplicate things. I'm not 100% certain I understand what you want, but try the net use command to connect a drive letter...

net use * \\server\share /user:domain\user password /persistent:no

This will map a drive from one system to another using the credentials specified.

0

Share this post


Link to post
Share on other sites

Terminal Services session to a server that is a domain member?

If the files are held on a Windows Server, use IIS & WebDAV to access the files through a browser, and use integrated Windows authentication?

0

Share this post


Link to post
Share on other sites

didn't quite undersand your problem, but since you already shared the resource, isn't it easier to just set the permissions for that user and map the resource?

0

Share this post


Link to post
Share on other sites

Basically what we have is the single user setup on the laptop that's always logged in, and then we need the user to be able to access this network share using their credentials while still logged in as that user. I think I've got a solution worked out... I have a VBS script that executes and opens up an IE window to get thier user name and password. It then opens up the network share, and opens up an IE window that has a button for them to click to log them out of the network share. Its a bit complicated, but its the only solution I could come up with.

Here's the VBS Code:

' COMMENT: Gets a user's login name, then executes a RUNAS on the command prompt 
' that opens up Documents on Lexus with that user's credentials. For the
'
'
'
'
' **********************************************************************************
' Variable Declerations
' **********************************************************************************

On Error Resume Next
Dim WShell, strCommand
Set WshShell = CreateObject("Wscript.Shell")

' Open up Internet Exporer to get user input
Set objExplorer = WScript.CreateObject _
("InternetExplorer.Application", "IE_")

objExplorer.Navigate "file:///C:\Conference\Password.htm"
objExplorer.ToolBar = 0
objExplorer.StatusBar = 0
objExplorer.Width = 400
objExplorer.Height = 350
objExplorer.Left = 300
objExplorer.Top = 200
objExplorer.Visible = 1

' Loop while waiting for IE to close
Do While (objExplorer.Document.Body.All.OKClicked.Value = "")
Wscript.Sleep 250
Loop


' Take in the input from IE
strUsername = objExplorer.Document.Body.All.UserName.Value
strPassword = objExplorer.Document.Body.All.UserPassword.Value
strButton = objExplorer.Document.Body.All.OKClicked.Value
objExplorer.Quit
Wscript.Sleep 250

'Add the domain to the user name
strUsername = strUsername & "@<FQDN>"

'If the user clicked cancel, then end the script, if not open the server share
If strButton = "Cancelled" Then
Wscript.Quit
Else
' Setup the path to the server using the user's input credentials
strCommand = "net use \\<server>\<share> " & strPassword & " /USER:" & strUsername
' Wscript.Echo strCommand
WshShell.Run strCommand,0,True

' Open up an explorer window to the network share
strCommand = "explorer.exe \\<server>\<share>\"
' Wscript.Echo strCommand
WshShell.Run strCommand,3,True

' Open up Internet Exporer to get the user to logout
Set objExplorer = WScript.CreateObject _
("InternetExplorer.Application", "IE_")
objExplorer.Navigate "file:///C:\Conference\Close.htm"
objExplorer.ToolBar = 0
objExplorer.StatusBar = 0
objExplorer.Width = 400
objExplorer.Height = 350
objExplorer.Left = 300
objExplorer.Top = 200
objExplorer.Visible = 1

' Loop while waiting for IE to close
Do While (objExplorer.Document.Body.All.OKClicked.Value = "")
Wscript.Sleep 250
Loop

' Log the user out of Lexus
strCommand = "net use \\<server>\<share> /delete"
' Wscript.Echo strCommand
WshShell.Run strCommand,0,True
End If

Here's the first IE Window (Password.htm)

Sub RunScript
OKClicked.Value = "OK"
End Sub

Sub CancelScript
OKClicked.Value = "Cancelled"
End Sub

</SCRIPT>

<BODY>
<font size="2" face="Arial">
Username:    </font><font face="Arial">
<input type="InputBox" name="UserName" size="40"></font></p>
Password:    </font><font face="Arial">
<input type="password" name="UserPassword" size="40"></font></p>

<input type="hidden" name="OKClicked" size = "20">

<input id=runbutton class="button" type="button" value=" OK "
name="ok_button" onClick="RunScript">
   
<input id=runbutton class="button" type="button" value="Cancel"
name="cancel_button" onClick="CancelScript">

</BODY>

And here's the second (Close.htm)

<script LANGUAGE="VBScript">

Sub RunScript
OKClicked.Value = "OK"
End Sub

Sub CancelScript
OKClicked.Value = "Cancelled"
End Sub

</SCRIPT>

<BODY>
<font size="2" face="Arial">
Click the button below to log out of the network share     </font>
<input type="hidden" name="OKClicked" size = "20">

<input id=runbutton class="button" type="button" value=" OK "
name="ok_button" onClick="RunScript">

</BODY>

Edited by mojoxp
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.