Proposed Run litetouch.vbs from a batch file Win7??

  • Thursday, October 04, 2012 12:52 PM
     
     

    I'd like to create a batch file that connects to the share where litetouch.vbs is stored. I've create the following batch which works on my system (UAC shutoff) but will not execute on my other Win 7 systems (UAC at a 3). Since I'm pretty sure UAC is blocking the .bat does anyone have some tips on how I can achieve victory??

    Example of my batch

    start \\server\deploymentshare$\scripts\litetouch.vbs /user:username password

    I'm trying to make it easy for my techs to do hardlink migrations and run my apps only task sequence without manually mapping to the network share (Keep the kids out of the cookie jar).

All Replies

  • Thursday, October 04, 2012 12:56 PM
     
     

    Have you seen - http://blogs.technet.com/b/elevationpowertoys/archive/2010/05/25/uac-logon-scripts-and-the-launchapp-wsf-workaround.aspx


    Regards, Vik Singh "If this thread answered your question, please click on "Mark as Answer"

  • Thursday, October 04, 2012 1:22 PM
     
     
    Well I do believe that is a little over my head currently (I'm not much of a coder). Would it be possible for someone to dumb this down a little? Is that just for login scripts or will it work while logged into the system?
  • Thursday, October 04, 2012 1:40 PM
     
     Proposed

    Try this. Your command is marked in BOLD. Copy all the contents below and name it as example.vbs or whatever.vbs. This will basically launch the VB (below) then elevate and then call litetouch.vbs on the deployment share. (Have'nt tried it now, but should work)

    '---------------------------------------
    'Elevate this script before invoking it.
    '25.2.2011 FNL
    '---------------------------------------
    bElevate = False
    if WScript.Arguments.Count > 0 Then If WScript.Arguments(WScript.Arguments.Count-1) <> "|" then bElevate = True
    if bElevate Or WScript.Arguments.Count = 0 Then ElevateUAC
    Set oWshShell = CreateObject("WScript.Shell")
    oWshShell.run "cmd.exe /k start \\server\deploymentshare$\scripts\litetouch.vbs /user:username password"

    '-----------------------------------------
    'Run this script under elevated privileges
    '-----------------------------------------
    Sub ElevateUAC
        sParms = " |"
        If WScript.Arguments.Count > 0 Then
                For i = WScript.Arguments.Count-1 To 0 Step -1
                sParms = " " & WScript.Arguments(i) & sParms
            Next
        End If
    Set oShell = CreateObject("Shell.Application")
        oShell.ShellExecute "wscript.exe", WScript.ScriptFullName & sParms, , "runas", 1
        WScript.Quit
    End Sub


    Regards, Vik Singh "If this thread answered your question, please click on "Mark as Answer"

    • Proposed As Answer by Vik Singh Sunday, November 11, 2012 10:58 AM
    •  
  • Thursday, October 04, 2012 2:16 PM
     
     
    It seems with your help I've almost have it working. It runs on some systems but not others. On the systems it doesn't work on it gives me a Access denied in the cmd window.
  • Thursday, October 04, 2012 2:20 PM
     
     

    Guess: That is because the user logged in is not a Local Admin. You need Local Admin to run the script...


    Regards, Vik Singh "If this thread answered your question, please click on "Mark as Answer"

  • Thursday, October 04, 2012 2:27 PM
     
     
    They are setup as local admins with there domain account. Not local admins with a local computer account.
  • Thursday, October 04, 2012 2:33 PM
     
     

    That should be fine. Basically should have local admin rights.

    Can you explain in detail where you get access denied? Right after running the script?  After it opens CMD? Screenshot would help!!


    Regards, Vik Singh "If this thread answered your question, please click on "Mark as Answer"

  • Thursday, October 04, 2012 4:13 PM
     
     
    
  • Thursday, October 04, 2012 7:45 PM
     
     
    From what I can tell it seems as if the system wasn't using the credentials specified in the script and was defaulting to the logged in AD users credentials cause once I gave "everyone" read only access to the scripts folder it allow me to run the script and launch litetouch.wsf but its now not pulling the custom ini info in so I'm left with a blank deployment GUI.
  • Thursday, October 04, 2012 8:23 PM
     
     
    Yep that was the issue it wasn't passing the credentials in the script and instead used the currently logged in users credentials. Any idea how to correct that??