Jump to content

AUGH HELP! Can't Map a Drive! It doesn't map in script. When manually done, it says its already mapped! I have to install this tomorrow for security.


 Share

Recommended Posts

When my computer starts, it automatically is connected to a network drive with a certain usergroup. "Everyone". I can't use this usergroup anymore because then everyone can get on.

And I can't set the computer to not automatically map it because it has a program that returns all my settings back to the original state.

Anyways,

I created an extensive script that logs me in after entering a username/password.After I login, it's supposed to map the drive using a different usergroup. After running the script, I see that no drives have been mapped. When I try to map it manually, I get this message:

"The network folder specified is curently mapped using a different user name and password.

To connect using a different user name and password, first disconnect any existing mappings to this network share."

"

Then after I click ok, I get:

""Multiple connects to a server or shared resource by the same user, using more than one user name, are not allowed. Disconnect all previous connections to the server or shared resource and try again."

"

What am I doing wrong? The drive mappings have been disconnected. The script does it like 3 times and I've done it manually too.

Here's SOME of my program code:

Func login()

;Assign Null variables

GLOBAL $temppass = 0

GLOBAL $typepass = 1

GLOBAL $filepass = 2

GLOBAL $error = 0

Sleep(700)

MsgBox(0, "Program Loading... ", "After you press OK, please wait for the login box to come up. DO NOT press F2 Again!")

Sleep(700)

$linesinfile = _FileCountLines("\\b86902\Settings$\userlist.ini")

Sleep(1000)

$typeuser = InputBox("username?", "Enter your Username")

;user types name

For $j = 1 to $linesinfile

;this'll happen over every line in the file

$fileuser = FileReadLine("\\b86902\Settings$\userlist.ini", $j)

;it reads the user database

If $fileuser <> $typeuser Then

;if the name typed by the user isn't the line just read from the file

Do

$j = $j + 2

;add 2 to the line count since the password is on every other line as is the username

$fileuser = FileReadLine("\\b86902\Settings$\userlist.ini", $j)

;reads from the file on the line equal to $j

Until $fileuser = $typeuser OR $j > $linesinfile

;until the username is found or you reach the end of the file

EndIf

If $fileuser = $typeuser Then

;if the username is right-i hope it is after all that

$j = $j + 1

;adds a number to $j, which remember still is the line number where the username typed in is found

$typepass = InputBox("password?", "enter password for " & $fileuser, "", "*")

;the user types his/her password in, each character is replaced with a *

$filepass = FileReadLine("\\b86902\Settings$\userlist.ini", $j)

;reads the password from the file

If $typepass = 3 Then

;if the idiot user entered a wrong passwd

GLOBAL $error = 1

;displays an error, heres where you'd put an alert to the computer owner

EndIf

If $filepass <> $typepass Then

;if the idiot user entered a wrong passwd

msgbox(0, "error", "Password incorrect!!!")

GLOBAL $error = 1

;displays an error, heres where you'd put an alert to the computer owner

EndIf

If $typeuser = "" Then

;if the idiot user entered a wrong passwd

GLOBAL $error = 1

;displays an error, heres where you'd put an alert to the computer owner

EndIf

If $typepass = "" Then

;if the idiot user entered a wrong passwd

GLOBAL $error = 1

;displays an error, heres where you'd put an alert to the computer owner

EndIf

If $error = 0 Then

If $filepass = $typepass Then

;if the password is corect

GLOBAL $user = IniRead("\\b86902\Settings$\names.ini", $typeuser, "Name", "NotFound")

MsgBox(0, "Welcome " & $typeuser, $user &" is now logged in")

IniWrite("\\b86902\Settings$\sessions.ini", @ComputerName, "Name", $user)

;TESTING PURPOSES BELOW

;SplashTextOn($user, "", 50, -10, 300, 0, 100, "", 10)

ToolTip("Logged in as: " & $user, 450, 0)

DriveMapAdd("R:", "\\b86902\Yearbook" , 0, "b86902\yearbook", "yearbookpass

DriveMapAdd("U:", "\\b86902\PHOTOS" , 0, "b86902\yearbook", "yearbookpass")

EndIf

Else

return

EndIf

;a wellcome msg, here put the script to login to the shared drive

;Exit

EndIf

Next

;End Function

EndFunc ;==>_Exit

Edited by CrewXp
Link to comment
Share on other sites

DriveMapAdd("R:", "\\b86902\Yearbook" , 0, "b86902\yearbook", "yearbookpass
DriveMapAdd("U:", "\\b86902\PHOTOS" , 0, "b86902\yearbook", "yearbookpass")

In your code, I noticed the end of the first DriveMapAdd is missing the end quote and end parenthesis. However, if that were a part of your working (sort of) script, you would have received an AutoIt error rather than mapping issues.

Could you put in a DriveMapDel() before the DriveMapAdd() to make sure they are deleted before you add the mapped drives?

Link to comment
Share on other sites

yea, I accidently cut it off when I copied it on the forums. That's fine. Even if that was it, it still shoulda mapped the "u:", but it doesn't. And yea, I have DriveMapDel()'s at the beginning of the script. It looks like it works. The previous mapping disappears when I open My Computer. But I get that message

Link to comment
Share on other sites

it has a program that returns all my settings back to the original state

Do you mean the computer is in a security group that applies policies to it? Are you the admin? If so, you might want to look at your policies (possibly overlapping ones). If not, you may not be able to disconnect a mapped drive that was mapped by another account. You may only have read/list on that mapped drive?
...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format
Link to comment
Share on other sites

I believe that your problem is this line at the begining of the script:

_FileCountLines("\\b86902\Settings$\userlist.ini")

When you used this "\\b86902\Settings$\userlist.ini" windows make a network connecting without a drive letter using the logon user for credentials. When your script ask for user name and password to connect if the user name and password are different as the logon user by Windows Security you cannot connect to the same server or computer with two different credentials.

If you want to try open command prompt and type this:

net use R: \\b86902\Settings$

and then after succeful map to R: try mapping to U: using different credentials

net use U: \\b86902\PHOTOS user:Domain\Username password

you will have the same message because you are trying to connect to the same server or computer with two different credentials......

I haven't test it but may this fix your problem, right before these lines:

DriveMapAdd("R:", "\\b86902\Yearbook" , 0, "b86902\yearbook", "yearbookpass

DriveMapAdd("U:", "\\b86902\PHOTOS" , 0, "b86902\yearbook", "yearbookpass")

add this line:

DriveMapDel("\\b86902\settings$")

Edited by Danny35d
AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line
Link to comment
Share on other sites

Is there a way to read the ini through a username and password? Thx

Check the manual for: FileReadLine ( filehandle or "filename" [, line] )
...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format
Link to comment
Share on other sites

that seems logical. Do you know how I would be able to fix this? How would I be able to access users.ini like this? Is there a way to read the ini through a username and password? Thx

The are only two way that may fix your script is:

1) Ask for user name and password at the begging of the script and right after that map to R: and U: so

the _FileCount(.....) and _FileRead(.....) will used the same credential that were used to map R: and U:.

OR

2) Right before these lines:

DriveMapAdd("R:", "\\b86902\Yearbook" , 0, "b86902\yearbook", "yearbookpass

DriveMapAdd("U:", "\\b86902\PHOTOS" , 0, "b86902\yearbook", "yearbookpass")

add this line:

DriveMapDel("\\b86902\settings$")

this will delete the path connected with the logon user credentials right before you map to R: and U:

NOTE: if DriveMapDel don't work try using Run or Runwait with net use \\b86902\settings$ /d

Edited by Danny35d
AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line
Link to comment
Share on other sites

ok, I'm going to try your method 2 tomorrow when school starts up again. I'll post back here when I do.

But if Anyone Else here see's something wrong or can suggest something, please go ahead. Tomorrow will be my last day to get this ready before the students start coming in and using it. Thanks! I'll check back here tomorrow morning. Thx again

(I also posted another topic regarding screen lock, another security feature)

Edited by CrewXp
Link to comment
Share on other sites

still doesn't work. Here's my function code:

Func login()

;Assign Null variables

If $loggedin = 1 Then

msgbox(0, "YbManager", "You are already logged in! Press F10 to logout first, then re-run program!")

Else

GLOBAL $temppass = 0

GLOBAL $typepass = 1

GLOBAL $filepass = 2

GLOBAL $error = 0

Sleep(700)

MsgBox(0, "Program Loading... ", "After you press OK, please wait for the login box to come up. DO NOT press F2 Again!")

Sleep(700)

$linesinfile = _FileCountLines("\\b86902\Settings$\userlist.ini")

Sleep(1000)

$typeuser = InputBox("username?", "Enter your Username")

;user types name

For $j = 1 to $linesinfile

;this'll happen over every line in the file

$fileuser = FileReadLine("\\b86902\Settings$\userlist.ini", $j)

;it reads the user database

If $fileuser <> $typeuser Then

;if the name typed by the user isn't the line just read from the file

Do

$j = $j + 2

;add 2 to the line count since the password is on every other line as is the username

$fileuser = FileReadLine("\\b86902\Settings$\userlist.ini", $j)

;reads from the file on the line equal to $j

Until $fileuser = $typeuser OR $j > $linesinfile

;until the username is found or you reach the end of the file

EndIf

If $fileuser = $typeuser Then

;if the username is right-i hope it is after all that

$j = $j + 1

;adds a number to $j, which remember still is the line number where the username typed in is found

$typepass = InputBox("password?", "enter password for " & $fileuser, "", "*")

;the user types his/her password in, each character is replaced with a *

$filepass = FileReadLine("\\b86902\Settings$\userlist.ini", $j)

;reads the password from the file

If $typepass = 3 Then

;if the idiot user entered a wrong passwd

GLOBAL $error = 1

;displays an error, heres where you'd put an alert to the computer owner

EndIf

If $filepass <> $typepass Then

;if the idiot user entered a wrong passwd

msgbox(0, "error", "Password incorrect!!!")

GLOBAL $error = 1

;displays an error, heres where you'd put an alert to the computer owner

EndIf

If $typeuser = "" Then

;if the idiot user entered a wrong passwd

GLOBAL $error = 1

;displays an error, heres where you'd put an alert to the computer owner

EndIf

If $typepass = "" Then

;if the idiot user entered a wrong passwd

GLOBAL $error = 1

;displays an error, heres where you'd put an alert to the computer owner

EndIf

If $error = 0 Then

If $filepass = $typepass Then

;if the password is corect

GLOBAL $user = IniRead("\\b86902\Settings$\names.ini", $typeuser, "Name", "NotFound")

MsgBox(0, "Welcome " & $typeuser, $user &" is now logged in")

IniWrite("\\b86902\Settings$\sessions.ini", @ComputerName, "Name", $user)

;TESTING PURPOSES BELOW

;SplashTextOn($user, "", 50, -10, 300, 0, 100, "", 10)

ToolTip("Logged in as: " & $user, 450, 0)

DriveMapDel("O:")

DriveMapDel("R:")

DriveMapDel("U:")

DriveMapDel("\\b86902\settings$")

DriveMapDel("\\b86902\Settings$")

DriveMapDel("\\b86902\settings$\")

DriveMapDel("\\b86902\Settings$\")

DriveMapDel("\\b86902\")

DriveMapDel("\\b86902\Yearbook")

DriveMapDel("\\b86902\photos")

DriveMapDel("\\b86902")

DriveMapDel("\\b86902\Programs\")

DriveMapDel("\\b86902\Programs")

DriveMapDel("\\b86902")

DriveMapDel("\\b86902\*")

DriveMapDel("\\b86902\Programs\YbManager.exe")

DriveMapDel("\\b86902\Settings$\userlist.ini")

DriveMapDel("\\b86902\Settings$\time.ini")

DriveMapDel("\\b86902\Programs")

runwait(@comspec & ' /c ' & "ipconfig /release","",@SW_HIDE)

runwait(@comspec & ' /c ' & "ipconfig /renew","",@SW_HIDE)

Sleep(1000)

DriveMapAdd("R:", "\\b86902\Yearbook" , 0, "b86902\yearbook", "yearbooksecure")

DriveMapAdd("U:", "\\b86902\PHOTOS" , 0, "b86902\yearbook", "yearbooksecure")

;TIMESTAMP

$day = _DateDayOfWeek( @WDAY )

$time = @HOUR & ":" & @MIN & ":" & @SEC & "::" & @mon & "." & @mday & "." & @year

;$date = @mon & "." & @mday & "." & @year

;$myfile = FileOpen("C:\blah.txt",1)

;FileWriteLine($myfile,$value)

$loggedin = 1

Sleep(2000)

IniWrite ( "\\b86902\Settings$\time.ini", $typeuser, $day & "/Login", $time )

gui()

EndIf

Else

return

EndIf

;a wellcome msg, here put the script to login to the shared drive

;Exit

EndIf

Next

;End Function

EndIf

EndFunc ;==>_Exit

Link to comment
Share on other sites

also, I've tried this to test it, IT DIDN'T WORK. So I don't think that's the problem. This doesn't call for any network connections. Before it maps it.

DriveMapDel("O:")

DriveMapDel("R:")

DriveMapDel("U:")

DriveMapDel("\\b86902\settings$")

DriveMapDel("\\b86902\Settings$")

DriveMapDel("\\b86902\settings$\")

DriveMapDel("\\b86902\Settings$\")

DriveMapDel("\\b86902\")

DriveMapDel("\\b86902\Yearbook")

DriveMapDel("\\b86902\photos")

DriveMapDel("\\b86902")

DriveMapDel("\\b86902\Programs\")

DriveMapDel("\\b86902\Programs")

DriveMapDel("\\b86902")

DriveMapDel("\\b86902\*")

DriveMapDel("\\b86902\Programs\YbManager.exe")

DriveMapDel("\\b86902\Settings$\userlist.ini")

DriveMapDel("\\b86902\Settings$\time.ini")

DriveMapDel("\\b86902\Programs")

runwait(@comspec & ' /c ' & "ipconfig /release","",@SW_HIDE)

runwait(@comspec & ' /c ' & "ipconfig /renew","",@SW_HIDE)

Sleep(1000)

DriveMapAdd("R:", "\\b86902\Yearbook" , 0, "b86902\yearbook", "yearbooksecure")

DriveMapAdd("U:", "\\b86902\PHOTOS" , 0, "b86902\yearbook", "yearbooksecure")

MsgBox(4096,"", "Drives mapped!")

Link to comment
Share on other sites

also, I've tried this to test it, IT DIDN'T WORK. So I don't think that's the problem. This doesn't call for any network connections. Before it maps it.

Are you the admin? If not, you are probably banging your head against a security policy.
...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format
Link to comment
Share on other sites

I don't really see what that has to do with this. Yes, I'm an admin. When I log on to the computer using workstation logged in as administrator or admin, I still get the same problem.

And also, it seems my script only works on my computer (and I connect to the network the same as everyone else). But some times I have found, it didn't map on mine. But it's never worked on anyone elses.

Link to comment
Share on other sites

I found something out. When I put the program individually on each computer's W: (a drive that u can put things on without DeepFreeze taking it off), and restart the computer. Then try to login again, it works.

But this will not allow me to update the program easily. I will have to manually put it on each computer again.

Before, I put a shortcut on each computer that ran "\\b86902\Programs\YbManager.exe"

or "\\b86902\yearbook\YbManager.exe"

(Can't remember which one, both have the file)

Is there any way to fix my problem now that I have found the problem?

Edited by CrewXp
Link to comment
Share on other sites

I really don't know much about Deep Freeze....

What it is W:? a network share or hard disk partition

Also you can try to keep your script on a network share and create a shortcut of the script on W:

This way the only file to update is the one on the share....

Hope this will help you ;)

AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line
Link to comment
Share on other sites

Is there any way to fix my problem now that I have found the problem?

1. Uninstall Deepfreeze

2. Tell us everything about your problem before asking for input

...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format
Link to comment
Share on other sites

My W: is a physical drive. It's just a partition. Is there any way to have a shortcut point to like //b86902/programs/YbManager.exe so it will work? Again, To get it to work, I have to manually copy it to my computer, I can't run it off the network.

Maybe, is there a way to create a loader, that downloads the YbManager file to your computer, then exit. Then start up YbManager on the computer? Thanks!

Link to comment
Share on other sites

From the DeepFreeze website:

Deep Freeze makes computing environments easier to manage and maintain. Each restart eradicates all changes and resets the computer to its original state, right down to the last byte.

Why do you keep asking? Is it because we keep answering?
...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...