Jump to content
Sign in to follow this  

Problem with iniwrite and DriveMapAdd in Vista

Recommended Posts


I'm trying to create a Login client for our Windows users. I can get the compiled script to run in XP but am having trouble in Vista. Below is a snippet of code from the script. The trouble I am having is with the iniwrite and DriveMapAdd functions. The compiled program resides in the Program Files folder, when it is first run if the ini doesn't exist it is created, then the drive mapping commands occur. If I run the code below the ini never gets created, but the drive mappings are successful.

If I try including "#RequireAdmin" at the beginning of the script the ini file does get created, but I have problems with the drive mappings. The mapped drives never show up under My Computer. In my main program I check the error codes of the mapping commands and it reports the drive was successfully mapped.

I would prefer not to have to use #RequireAdmin in my program since it always prompts the user for permission to run. My only thought is that there is a problem with my program creating the ini file in the Program Files directory which is a protected folder in Vista.

Any assistance you can provide is greatly appreciated.



#include <GUIConstants.au3>
#include <inet.au3>
#include <Array.au3>

If FileExists("wiredlogin.ini") Then
   MsgBox(4096, "", "wiredlogin.ini exists.")
    MsgBox(4096,"", "wiredlogin.ini does not exist.")
    IniWrite("wiredlogin.ini", "USERID", "userid", "")
    IniWrite("wiredlogin.ini", "H Drive Mapped to", "drivemapped", "H:")
    IniWrite("wiredlogin.ini", "Launch on Startup", "launch", "yes")

DriveMapAdd("y:", "\\servername\apps", 0,  "loginname", "password")
DriveMapAdd("x:", "\\servername\apps", 0,  "loginname", "password")
DriveMapAdd("z:", "\\servername\apps", 0,  "loginname", "password")

Share this post

Link to post
Share on other sites

I thought AutoIt was not compatible with Vista

hmmmm, must just be ... sorta.. compatible LOL

Edited by danwilli

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