Jump to content

Recommended Posts


Posted (edited)

Try calling this vbscript instead, as your batch file will run the vbscript and only continue when the network drive is available and mapped (useful when waiting for a slow wireless net connection to fire up too):

Dim sTestPath
Dim intCount
Dim objnet

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("WScript.Shell")
Set objVolatileEnv = objShell.Environment("VOLATILE")
Set objnet = CreateObject("Wscript.Network")

' An UNC path here that will be available when network connection is in place
sTestPath = "\\pentium4\unattended
intCount = 1

' test on volatile environment variable to avoid running logon script
' if the user has already run the logon script.
If Not objVolatileEnv("LogonScript") = "Done" Then

Do Until objFSO.FolderExists(sTestPath)
' sleep 5 seconds
WScript.Sleep 5000
intCount = intCount + 1
If intCount = 60 Then
MsgBox "Unable to connect to network share for 5 minutes. Please notify your network administrator."
Exit Do
End If
Loop

' share/folder available on server now, so continue
objnet.MapNetworkDrive "U:", "\\pentium4\unattended\Apps\Firefox","True","domain\user","password"

End If

Watch out for word wrap there - the whole objnet.MapNetworkDrive section is one line, not two (as it may appear here on the boards).

Edited by cluberti
Posted

thanks but i'd rather just use a simple net use. I just don't understand why it didn't map. Do i need to do something special in the RunOnceEx.cmd to make it work?

see I have a list of apps i want to install from the network.

Posted

Ok you want to add Reg values to install on next reboot but you want the install from a network location instead of local or cd?

Is this right?

have you got network going or is it just your server and the client?

Posted

Perhaps your network interface isn't working? Try putting in an ipconfig /all statement, then a pause, and see if you've even got an IP address.

Posted

I haven't gotten it to work from RunOnce so just call it from a command file someplace like this...

REG ADD %KEY%\075 /VE /D "Mapping Network Drives" /f

REG ADD %KEY%\075 /V 1 /D "%systemdrive%\install\Network\Network.cmd" /f

Posted

ok during the install of windows xp. I map to

u: \\pentium4\unattended\apps

this works fine. it maps. Inside the apps folder there is a firefox folder.

in my runonceex.cmd

i put

REG ADD %KEY%\008 /VE /D "FireFox 1.5" /f

REG ADD %KEY%\008 /V 1 /D "U:\Firefox\Firefox Setup 1.5.0.2.exe -ms" /f

i get unable to find \firefox\firefox

what am i doing wrong.

Posted

I think the VBS script that cluberti posted would be the best way to go, you can start the install from it.

Dim sTestPath
Dim intCount
Dim objnet




Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("WScript.Shell")
Set objVolatileEnv = objShell.Environment("VOLATILE")
Set objnet = CreateObject("Wscript.Network")

' An UNC path here that will be available when network connection is in place
sTestPath = "\\pentium4\unattended
intCount = 1

' test on volatile environment variable to avoid running logon script
' if the user has already run the logon script.
If Not objVolatileEnv("LogonScript") = "Done" Then

Do Until objFSO.FolderExists(sTestPath)
' sleep 5 seconds
WScript.Sleep 5000
intCount = intCount + 1
If intCount = 60 Then
MsgBox "Unable to connect to network share for 5 minutes. Please notify your network administrator."
Exit Do
End If
Loop

' share/folder available on server now, so continue
objnet.MapNetworkDrive "U:", "\\pentium4\unattended\Apps\Firefox","True","domain\user","password"
'''' Checks to see if it in the correct directory
If objFSO.FileExists("U:\Firefox\Firefox Setup 1.5.0.2.exe") Then
objShell.Run(chr(34) & "U:\Firefox\Firefox Setup 1.5.0.2.exe -ms" & chr(34)),1,True
Else
objShell.Popup "Cannot Find This U:\Firefox\Firefox Setup 1.5.0.2.exe",10,"Missing", 0 + 32
End If
End If

Posted

I think the VBS script that cluberti posted would be the best way to go, you can start the install from it.

Dim sTestPath
Dim intCount
Dim objnet




Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("WScript.Shell")
Set objVolatileEnv = objShell.Environment("VOLATILE")
Set objnet = CreateObject("Wscript.Network")

' An UNC path here that will be available when network connection is in place
sTestPath = "\\pentium4\unattended
intCount = 1

' test on volatile environment variable to avoid running logon script
' if the user has already run the logon script.
If Not objVolatileEnv("LogonScript") = "Done" Then

Do Until objFSO.FolderExists(sTestPath)
' sleep 5 seconds
WScript.Sleep 5000
intCount = intCount + 1
If intCount = 60 Then
MsgBox "Unable to connect to network share for 5 minutes. Please notify your network administrator."
Exit Do
End If
Loop

' share/folder available on server now, so continue
objnet.MapNetworkDrive "U:", "\\pentium4\unattended\Apps\Firefox","True","domain\user","password"
'''' Checks to see if it in the correct directory
If objFSO.FileExists("U:\Firefox\Firefox Setup 1.5.0.2.exe") Then
objShell.Run(chr(34) & "U:\Firefox\Firefox Setup 1.5.0.2.exe -ms" & chr(34)),1,True
Else
objShell.Popup "Cannot Find This U:\Firefox\Firefox Setup 1.5.0.2.exe",10,"Missing", 0 + 32
End If
End If

Posted
REG ADD %KEY%\008 /V 1 /D "U:\Firefox\Firefox Setup 1.5.0.2.exe -ms" /f

Note the spaces in your path! You would need it to look like this for what you are currently doing to work:

REG ADD %KEY%\008 /V 1 /D "\"U:\Firefox\Firefox Setup 1.5.0.2.exe\" -ms" /f

Posted

thanks man

that did it.

Now it seems I can't get spybot 1.4 to install and autoupdate. I have checked the forums and even read the spybot faq's

once again what am i doing wrong?

REG ADD %KEY%\009 /VE /D "Spybot Search and Destory 1.4" /f

REG ADD %KEY%\009 /V 1 /D "\"U:\Spybot\spybotsd14.exe\" /verysilent /autoupdate" /f

Posted
thanks man

that did it.

Now it seems I can't get spybot 1.4 to install and autoupdate. I have checked the forums and even read the spybot faq's

once again what am i doing wrong?

REG ADD %KEY%\009 /VE /D "Spybot Search and Destory 1.4" /f

REG ADD %KEY%\009 /V 1 /D "\"U:\Spybot\spybotsd14.exe\" /verysilent /autoupdate" /f

Try it without the backslash

REG ADD %KEY%\009 /V 1 /D ""U:\Spybot\spybotsd14.exe" /verysilent /autoupdate" /f

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
  • Recently Browsing   0 members

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