+ Post New Thread
Page 3 of 3 FirstFirst 123
Results 31 to 43 of 43
O/S Deployment Thread, Anyone write me a VB Script please? in Technical; look here : VBScript - Problem with wsh.shell not waiting for command to finish executing Use Exec Instead of Run ...
  1. #31

    mac_shinobi's Avatar
    Join Date
    Aug 2005
    Posts
    9,710
    Thank Post
    3,246
    Thanked 1,048 Times in 970 Posts
    Rep Power
    364
    look here :

    VBScript - Problem with wsh.shell not waiting for command to finish executing

    Use Exec Instead of Run

    Code:
    '-----------------------------------------------------------------------
    ' execute commandline and get result into strResult
    '-----------------------------------------------------------------------
    Set oWsc = CreateObject("WScript.Shell")
    Set oExec = oWsc.Exec(("Exchange2003\SETUP\I386\SETUP.EXE /unattendfile unattend.ini")
    ' wait until finished
    Do While oExec.Status <> 1
        WScript.Sleep 100
    Loop
    '--------------------------------------------------------
    ' get output from StdOut and StdErr
    '--------------------------------------------------------
    strResult = oExec.StdOut.ReadAll() & oExec.StdErr.ReadAll()
    Set oExec = Nothing
    The last chunk is error checking / placing any errors into the variable strResult so you should be able to put your other code just after the Loop ( might want a sleep or pause for a few seconds though ??

    So I presume it would be something along the lines of

    Code:
    ' Your code to map the T Drive etc here
    
    Set WshShell = WScript.CreateObject("WScript.Shell") 
    Set oExec = WshShell.Exec(("Exchange2003\SETUP\I386\SETUP.EXE /unattendfile unattend.ini")
    ' wait until finished
    Do While oExec.Status <> 1
        WScript.Sleep 100
    Loop
    
    objNetwork.RemoveNetworkDrive "T:", True, True
    
    
    '--------------------------------------------------------
    ' error checking which you can delete or leave -  get output from StdOut and StdErr
    '--------------------------------------------------------
    strResult = oExec.StdOut.ReadAll() & oExec.StdErr.ReadAll()
    Set oExec = Nothing
    
    ' The Remainder of your code
    If you are doing the same to launch and install other apps and then remove the network drive / path then you may want to repeat a similar chunk of code to make it wait for the app to finish installing.

    Also you don't want to replicate the shell objects etc so you can safely use your one and adjust the code to suit, also you will need to adjust the path for the installer in my code above

    In your code you have :

    Code:
    Set WshShell = WScript.CreateObject("WScript.Shell") 
    WshShell.Run "msiexec.exe /qn /i """t:\APPS\AB\v6\silent\abtclient6.msi""""
    Where as in the example I posted they have used

    Code:
    Set oWsc = CreateObject("WScript.Shell")
    Set oExec = oWsc.Exec(("Exchange2003\SETUP\I386\SETUP.EXE /unattendfile unattend.ini")
    ' wait until finished
    Do While oExec.Status <> 1
        WScript.Sleep 100
    Loop
    They are trying to do something for Exchange as per the path : "Exchange2003\SETUP\I386\SETUP.EXE /unattendfile unattend.ini

    where as one of your paths is : t:\APPS\AB\v6\silent\abtclient6.msi
    Last edited by mac_shinobi; 16th July 2012 at 03:16 PM.

  2. #32

    Join Date
    Jul 2008
    Location
    Merseyside
    Posts
    295
    Thank Post
    16
    Thanked 10 Times in 10 Posts
    Rep Power
    14
    Wow, im confused now! I dont know what my best bet is, to install the two apps using MDT or to try to get the vbscript to work properly, or to just leave it as it is .........

    If I do the MDT app deploy route what do I put in the command line and working directory boxes?

  3. #33
    januttall's Avatar
    Join Date
    Sep 2010
    Posts
    225
    Thank Post
    17
    Thanked 28 Times in 28 Posts
    Blog Entries
    1
    Rep Power
    13
    youd be better just sticking with the bat file for the above and i don't know why your mapping t to then disconnect? you can access shares via bat files getting rid of the two lines. having it in a vbs just makes it hard to modify and ten times more dificult to create. yea vbs is grate for things like pauses or complicated steps but for the sake of the above stick with a bat. you could put a check in make shure it hasent allready been run and if it has exit. then deploy it via a GPO, thats how we do it.
    Last edited by januttall; 16th July 2012 at 03:17 PM.

  4. #34
    Jamo's Avatar
    Join Date
    Jan 2009
    Posts
    1,349
    Thank Post
    66
    Thanked 175 Times in 147 Posts
    Rep Power
    60
    Lol options!

    My bet (but thats cus its the one I know, my VBScript isn't the best) is on using MDT as you will get better error explanations and will get a better view of where you are in the task sequences with a progress bar

    As I mentioned earlier a single bundle app attached to a task sequence and all the other apps as single dependencies to the bundle is the easiest way of achieving easy maintenance of the task sequences.

  5. #35

    mac_shinobi's Avatar
    Join Date
    Aug 2005
    Posts
    9,710
    Thank Post
    3,246
    Thanked 1,048 Times in 970 Posts
    Rep Power
    364
    Not done MDT before so will have to leave that for someone else to advise you on, If you want to continue on the vbs path, either myself, @Steve21 or the likes can try and assist with that.

    Entirely up to you

    MDT option sounds easier ( assuming it is easy enough to setup and get working ) as clearly makes admin and seeing errors etc a lot easier from what @Jamo is saying above
    Last edited by mac_shinobi; 16th July 2012 at 03:21 PM.

  6. #36
    Jamo's Avatar
    Join Date
    Jan 2009
    Posts
    1,349
    Thank Post
    66
    Thanked 175 Times in 147 Posts
    Rep Power
    60
    In the command line you just put the msiexec /i "pathtomsi.msi" /qn command I usually leave the working directory blank and it just uses the current dir.

    You can then chose the connect using credentials to your admin user with the ability to connect to the share

  7. Thanks to Jamo from:

    mac_shinobi (16th July 2012)

  8. #37

    Join Date
    Jul 2008
    Location
    Merseyside
    Posts
    295
    Thank Post
    16
    Thanked 10 Times in 10 Posts
    Rep Power
    14
    ah right ok, i think ill try mdt tomorrow (already have a room imaging at the min so dont wanna mess) if that fails ill just stick with my good old vbs that literally calls my batch file lol.

    i'll return with more info! thanks for your help so far everyone.

  9. Thanks to mbrunt from:

    mac_shinobi (16th July 2012)

  10. #38

    Join Date
    Jul 2008
    Location
    Merseyside
    Posts
    295
    Thank Post
    16
    Thanked 10 Times in 10 Posts
    Rep Power
    14
    where abouts can i put credentials, cant see anything in the application or task sequence.

  11. #39
    Jamo's Avatar
    Join Date
    Jan 2009
    Posts
    1,349
    Thank Post
    66
    Thanked 175 Times in 147 Posts
    Rep Power
    60
    Good question....

    I'm at home today!! By default MDT will connect with the local machines administrator account. I think when you select the bundle application within the task sequence you can get MDT to change the account for that taask sequence step. (So its in the task sequence rather than the individual app)

  12. #40

    Join Date
    Jul 2008
    Location
    Merseyside
    Posts
    295
    Thank Post
    16
    Thanked 10 Times in 10 Posts
    Rep Power
    14
    Sorry I dont really see what you mean by bundle application, my only options in the install applications part of the task sequence are "install multiple applications" or "install a single application" but theres no box for alternative credentials etc...

  13. #41
    Jamo's Avatar
    Join Date
    Jan 2009
    Posts
    1,349
    Thank Post
    66
    Thanked 175 Times in 147 Posts
    Rep Power
    60


    I might need to check when I look tomorrow. You can use run command line if you just want to run the msiexec command and that definitely has a run as command. I will have to double check my application installs as they are all from a share which has read only to 'Authenticated Users' meaning that anyone can read + execute the apps.

  14. #42
    Jamo's Avatar
    Join Date
    Jan 2009
    Posts
    1,349
    Thank Post
    66
    Thanked 175 Times in 147 Posts
    Rep Power
    60
    Just for reference, install multiple applications installs the 'required' applications for that machine type, which usually only come around when you have the database integrated with MDT. Install Single Application is what you would want, is there anything in the second tab? I may be going mad here, sitting at home with a cold so not thinking very well at all lol

  15. #43
    Jamo's Avatar
    Join Date
    Jan 2009
    Posts
    1,349
    Thank Post
    66
    Thanked 175 Times in 147 Posts
    Rep Power
    60
    Right...

    Had a look last night and you have a couple of options:

    Use the Run Command Line task in a task sequence for each of the stages of your VBS script. (This will allow you to run as a different user, its a section in the task sequence editor not the application editor sorry my bad!)

    Allow Authenticated Users/Everyone as read only to your shares with installers on, and use an MDT application to install just passing the full unc path to the MSI.

    And hidden option C:

    Split the batch files up and install them as single MDT applications, this gives you a better chance of catching errors whilst still allowing you to use batch files to install

    I personally can't stand VB Script for simple installs, the syntax is awful for just calling command lines. Hope that helps somewhat!

SHARE:
+ Post New Thread
Page 3 of 3 FirstFirst 123

Similar Threads

  1. vb script help please
    By mac_shinobi in forum Scripts
    Replies: 13
    Last Post: 31st March 2011, 12:39 PM
  2. Replies: 0
    Last Post: 22nd November 2009, 11:07 AM
  3. Replies: 5
    Last Post: 14th November 2009, 04:37 PM
  4. Writing to Excel from .vbs script
    By Samson in forum Windows
    Replies: 6
    Last Post: 15th October 2008, 07:34 AM
  5. VBS script for prestaging computers anyone?
    By ChrisH in forum Scripts
    Replies: 7
    Last Post: 23rd June 2006, 09:59 AM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •