Jump to content

Mapping a network drive from Window7 32 & 64


Recommended Posts

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****

#AutoIt3Wrapper_icon=..\..\32bit\731\blha\objectw\blsswh.ico

#AutoIt3Wrapper_outfile=Genesmap.exe

#AutoIt3Wrapper_UseX64=y

#AutoIt3Wrapper_Add_Constants=n

#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

Dim $var1, $var2

DriveMapAdd("Q:", "\\Genes-pc\c", 0, "Gene", "Canes")

If @error = 0 Then

MsgBox(4096, "Genes's Computer Mapping", "Genes's Computer Sucessfully Mapped")

Endif

if @error = 1 then

MsgBox(4096, "Genes's Computer Mapping", "Geness's Computer is not on")

EndIf

if @error = 2 then

MsgBox(4096, "Genes's Computer Mapping", "Geness's Computer is not on")

EndIf

If @error = 3 Then

MsgBox(4096, "Genes's Computer Mapping", "Genes's Computer Already Mapped")

EndIf

Exit

This works under vista and XP.

Thanks.

Link to comment
Share on other sites

Hi,

give FullQualifiedDomainName one try:

DriveMapAdd("Q:", "\\Genes-pc.mydomain.local\c", 0, "Gene", "Canes")

or try

Domain Account:

DriveMapAdd("Q:", "\\Genes-pc\c", 0, "mydomain\Gene", "Canes")

Local Useraccount on Genes-pc:

DriveMapAdd("Q:", "\\Genes-pc\c", 0, "Genes-PC\Gene", "Canes")

;-))

Stefan

@Edit: Have you tried IP Adress instead of Genes-pc?

Link to comment
Share on other sites

I would have a look at this and see if that helps, I had the sam issue when conection to none windows machines Icame up with this work around, so fare XP, Windows 7 work well.

If $ostemp = "vista_win7" Then
;this is only needed if your accessing external none windows based NAS devices if you using Vista or Windows 7 as a client
;read this for more help with Vista and windows 7: [url="http://social.technet.microsoft.com/Forums/en-CA/w7itpronetworking/thread/4606ad12-1f23-4231-8597-8e515422d57d"]http://social.technet.microsoft.com/Forums/en-CA/w7itpronetworking/thread/4606ad12-1f23-4231-8597-8e515422d57d[/url] $operation="Vista and Windows 7"
$public = "[url="file://\10.0.0.4"]\\10.0.0.4[/url]"
$accounts = "[url="file://\10.0.0.3"]\\10.0.0.3[/url]"
$source = "[url="file://\10.0.0.3"]\\10.0.0.3[/url]"
$chaos = "[url="file://\10.0.0.3"]\\10.0.0.3[/url]"
$homebase = "[url="file://\10.0.0.3"]\\10.0.0.3[/url]"
$operation = "Vista Mode"
ElseIf $ostemp = "winnt" Then
$public = "[url="file://\public"]\\public[/url]"
$accounts = "[url="file://\CF-NAS1"]\\CF-NAS1[/url]"
$source = "[url="file://\CF-NAS1"]\\CF-NAS1[/url]"
$chaos = "[url="file://\CF-NAS1"]\\CF-NAS1[/url]"
$homebase = "[url="file://\CF-NAS1"]\\CF-NAS1[/url]"
$operation = "XP Mode"
ElseIf $ostemp = "server" Then
Exit
ElseIf $ostemp = "preinstall" Then
Exit
Else
MsgBox(16, "OS Incompatability", "this domain fully supports Windows XP/2000 Vista and Windows 7 workstations" & _
   @CRLF & "with 2003/8 server support both 32 and 64bit" & _
   @CRLF & @CRLF & "Current logged OS version is: " & @OSVersion)
Exit
EndIf

Here my find OS function....simple but it works well so far..

Func _OSGet()
Switch @OSVersion
  Case "WIN_7"
   $ostemp = "vista_win7"
  Case "WIN_XP"
   $ostemp = "winnt"
  Case "Win_2000"
   $ostemp = "winnt"
  Case "WIN_VISTA"
   $ostemp = "vista_win7"
  Case "WIN_2008"
   $ostemp = "server"
  Case "WIN_2008R2"
   $ostemp = "server"
  Case "WIN_2003"
   $ostemp = "server"
  Case "WIN_XPe"
   $ostemp = "preinstall"
  Case Else
   MsgBox(32, "OS Version Machine Diags", "User " & @UserName & " on computer " & @ComputerName & " running OS " & @OSVersion & " " & @OSArch & " Architecture", 10)
   Exit
EndSwitch
_ArchGet()
EndFunc   ;==>_OSGet

Drive map function

Func _mapdrive($DriveLtr, $DrivePath)
$var_DrivePath = _StringBetween($DrivePath, "\\", "\")
If Ping($var_DrivePath[0], 25) Then ; so now the function will not try to connect to a device that is not present, make sure your firewall allows ICBM echo requests.
  DriveMapAdd($DriveLtr, $DrivePath, 1) ; thanks to 99ojo for his help, see [url="http://www.autoitscript.com/forum/index.php?showtopic=110567&st=0&gopid=776497&#entry776497"]http://www.autoitscript.com/forum/index.php?showtopic=110567&st=0&gopid=776497&#entry776497[/url]
  Switch @error
   Case 1
    MsgBox(16, "O.M.G Error", "An unknown error occured on " & $DrivePath & " trying to be mapped as local drive " & $DriveLtr & " maybe end device is not avilable for mapping")
   Case 2
    MsgBox(16, "Access Error", "Access to the remote share " & $DrivePath & " was denied")
   Case 3
    MsgBox(64, "Map Drive Error", "The device/drive " & $DriveLtr & " is already assigned and will be deleted")
   Case 4
    MsgBox(16, "Device Error", "Invalid device " & $DriveLtr & " name")
   Case 5
    MsgBox(16, "Connect to Remote Share Error", "Invalid remote share :" & $DrivePath)
   Case 6
    MsgBox(16, "Password Error for user :" & @UserName, "Invalid password for " & $DriveLtr & $DrivePath)
   Case Else
    ;MsgBox(64, "Completed!", "Mapped " & $DriveLtr & " to share " & $DrivePath)
    Sleep(500)
  EndSwitch
Else
  MsgBox(16, "Device Error", $var_DrivePath[0] & " Device not present or pingable!" & @CRLF & @CRLF & "Please contact Computer Facilities support on " & @CRLF & "0414-533784 or e-mail: [email="support@computer-facilities.com"]support@computer-facilities.com[/email]")
EndIf
EndFunc   ;==>_mapdrive

[topic='115020'] AD Domain Logon Script[/topic]

Link to comment
Share on other sites

Thsnks for your help! I am getting these errors on compile.

C:\tools\Scripts\tt.au3(8,12) : WARNING: $ostemp: possibly used before declaration.

If $ostemp =

~~~~~~~~~~~^

C:\tools\Scripts\tt.au3(11,18) : ERROR: syntax error

$public = "[url="file

~~~~~~~~~~~~~~~~~^

C:\tools\Scripts\tt.au3(12,20) : ERROR: syntax error (illegal character)

$accounts = "[url="file

~~~~~~~~~~~~~~~~~~~^

C:\tools\Scripts\tt.au3(13,18) : ERROR: syntax error (illegal character)

$source = "[url="file

~~~~~~~~~~~~~~~~~^

C:\tools\Scripts\tt.au3(14,17) : ERROR: syntax error (illegal character)

$chaos = "[url="file

~~~~~~~~~~~~~~~~^

C:\tools\Scripts\tt.au3(15,20) : ERROR: syntax error (illegal character)

$homebase = "[url="file

~~~~~~~~~~~~~~~~~~~^

C:\tools\Scripts\tt.au3(18,18) : ERROR: syntax error (illegal character)

$public = "[url="file

~~~~~~~~~~~~~~~~~^

C:\tools\Scripts\tt.au3(19,20) : ERROR: syntax error (illegal character)

$accounts = "[url="file

~~~~~~~~~~~~~~~~~~~^

C:\tools\Scripts\tt.au3(20,18) : ERROR: syntax error (illegal character)

$source = "[url="file

~~~~~~~~~~~~~~~~~^

C:\tools\Scripts\tt.au3(21,17) : ERROR: syntax error (illegal character)

$chaos = "[url="file

~~~~~~~~~~~~~~~~^

C:\tools\Scripts\tt.au3(22,20) : ERROR: syntax error (illegal character)

$homebase = "[url="file

~~~~~~~~~~~~~~~~~~~^

C:\tools\Scripts\tt.au3(35,6) : ERROR: syntax error (illegal character)

Here my

~~~~~^

C:\tools\Scripts\tt.au3(8,12) : ERROR: $ostemp: undeclared global variable.

If $ostemp =

~~~~~~~~~~~^

C:\tools\Scripts\tt.au3 - 12 error(s), 1 warning(s)

Link to comment
Share on other sites

Global $ostemp

_OSGet()

If $ostemp = "vista_win7" Then

;this is only needed if your accessing external none windows based NAS devices if you using Vista or Windows 7 as a client

;read this for more help with Vista and windows 7: http://social.technet.microsoft.com/Foru...ead/4606ad12-1f23-4231-8597-8e515422d57d

$operation="Vista and Windows 7"

$public = "\\10.0.0.4"

$accounts = "\\10.0.0.3"

$source = "\\10.0.0.3"

$chaos = "\\10.0.0.3"

$homebase = "\\10.0.0.3"

$operation = "Vista Mode"

ElseIf $ostemp = "winnt" Then

$public = "\\public"

$accounts = "\\CF-NAS1"

$source = "\\CF-NAS1"

$chaos = "\\CF-NAS1"

$homebase = "\\CF-NAS1"

$operation = "XP Mode"

ElseIf $ostemp = "server" Then

Exit

ElseIf $ostemp = "preinstall" Then

Exit

Else

MsgBox(16, "OS Incompatability", "this domain fully supports Windows XP/2000 Vista and Windows 7 workstations" & _

@CRLF & "with 2003/8 server support both 32 and 64bit" & _

@CRLF & @CRLF & "Current logged OS version is: " & @OSVersion)

Exit

EndIf

Func _OSGet()

Switch @OSVersion

Case "WIN_7"

$ostemp = "vista_win7"

Case "WIN_XP"

$ostemp = "winnt"

Case "Win_2000"

$ostemp = "winnt"

Case "WIN_VISTA"

$ostemp = "vista_win7"

Case "WIN_2008"

$ostemp = "server"

Case "WIN_2008R2"

$ostemp = "server"

Case "WIN_2003"

$ostemp = "server"

Case "WIN_XPe"

$ostemp = "preinstall"

Case Else

MsgBox(32, "OS Version Machine Diags", "User " & @UserName & " on computer " & @ComputerName & " running OS " & @OSVersion & " " & @OSArch & " Architecture", 10)

Exit

EndSwitch

_ArchGet()

EndFunc ;==>_OSGet

Func _ArchGet()

Switch @OSArch

Case "X86"

Case Else

MsgBox(32, "32/64bit Architecture", "User " & @UserName & " on computer " & @ComputerName & " running OS " & @OSVersion & " " & @OSArch & " Architecture", 10)

Exit

EndSwitch

EndFunc ;==>_ArchGet

Hope this helps..

Edited by PeterAtkin

[topic='115020'] AD Domain Logon Script[/topic]

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...