Jump to content

BG-Info w/ RunAS and UNC Paths


Recommended Posts

Current version# v3.2.12.1

We are using BGinfo to post computer name/asset info on user PC desktops for ease of connecting remotely...etc...

So... if the users do 'not' have local admin rights (which any good admin does NOT want them to... muaahahahaaa) -- then BGinfo does not function correctly when attempting to re-write the text information over their background display photo...

...We currently have the bginfo app on a UNC path along with our customized layout for how we want it to display...

This works just fine for admin/domain admin/local admin accounts... but when trying to point a user login to the same location via login script-- bginfo fails out...

The idea was to use 'autoit' to heighten the rights... run the bginfo... and exit...

Here is the code I have:

------------------------------

Local $sUserName = "-domainusername-"

Local $sPassword = "-thedomainuserpassword-"

Local $sDomain = "-domain-name"

RunAs($sUsername, $sDomain, $sPassword,0,@ScriptName,@ScriptDir)

Run("\\servername\login_progs\bginfo\bginfo.exe \\servername\login_progs\bginfo\carbis.bgi /timer:0 /NOLICPROMPT /SILENT")

------------------------------

This gets compiled to an '.exe' and added to a login script off of a share on the network...

After login tests with basic domain users... the script just hangs in the taskbar-- no failures, no error messages, just never seems to go anywhere really...

When running just the line:

\\servername\login_progs\bginfo\bginfo.exe \\servername\login_progs\bginfo\carbis.bgi /timer:0 /NOLICPROMPT /SILENT

On an account that is of higher status than a basic domain user... then we get our desired display... but even after using the autoit app to 'amp up' the rights... the

I recall doing something similar to this long ago with the 'RunAsSet' command which I understand to be 'gone' in this build version...

Any suggestions or examples to point me in the right direction would be appreciated!

thnx in advance...

Link to comment
Share on other sites

Current version# v3.2.12.1

We are using BGinfo to post computer name/asset info on user PC desktops for ease of connecting remotely...etc...

So... if the users do 'not' have local admin rights (which any good admin does NOT want them to... muaahahahaaa) -- then BGinfo does not function correctly when attempting to re-write the text information over their background display photo...

...We currently have the bginfo app on a UNC path along with our customized layout for how we want it to display...

This works just fine for admin/domain admin/local admin accounts... but when trying to point a user login to the same location via login script-- bginfo fails out...

The idea was to use 'autoit' to heighten the rights... run the bginfo... and exit...

Here is the code I have:

------------------------------

Local $sUserName = "-domainusername-"

Local $sPassword = "-thedomainuserpassword-"

Local $sDomain = "-domain-name"

RunAs($sUsername, $sDomain, $sPassword,0,@ScriptName,@ScriptDir)

Run("\\servername\login_progs\bginfo\bginfo.exe \\servername\login_progs\bginfo\carbis.bgi /timer:0 /NOLICPROMPT /SILENT")

------------------------------

This gets compiled to an '.exe' and added to a login script off of a share on the network...

After login tests with basic domain users... the script just hangs in the taskbar-- no failures, no error messages, just never seems to go anywhere really...

When running just the line:

\\servername\login_progs\bginfo\bginfo.exe \\servername\login_progs\bginfo\carbis.bgi /timer:0 /NOLICPROMPT /SILENT

On an account that is of higher status than a basic domain user... then we get our desired display... but even after using the autoit app to 'amp up' the rights... the

I recall doing something similar to this long ago with the 'RunAsSet' command which I understand to be 'gone' in this build version...

Any suggestions or examples to point me in the right direction would be appreciated!

thnx in advance...

Does this work?

Local $sUserName = "-domainusername-"
Local $sPassword = "-thedomainuserpassword-"
Local $sDomain = "-domain-name"
Local $BGInfo = "\\servername\login_progs\bginfo\bginfo.exe \\servername\login_progs\bginfo\carbis.bgi /timer:0 /NOLICPROMPT /SILENT"

RunAs($sUsername, $sDomain, $sPassword,0,$BGInfo,"\\servername\login_progs\bginfo")
Link to comment
Share on other sites

RunAs processes don't inherit the network access of the interactive user, so your (run-as privileged) child process doesn't have access to the \\servername share.

The most robust solution I've found is to:

1) Make a stage one script which does the RunAs work, simply calling the second script, and install it locally on the PC.

2) Make a stage two script that (when run as a privileged user) establishes a network connection with DriveMapAdd and performs and tasks that require the network connection; install it on the local computer as well or you could have the stage one script fetch it from a user accessible network share at run time.

The two stages can be performed by the same script rerunning itself, and I'm confident that one could find example UDFs for doing so on this forum be searching for rerun*...

Yes yes yes, there it was. Youth must go, ah yes. But youth is only being in a way like it might be an animal. No, it is not just being an animal so much as being like one of these malenky toys you viddy being sold in the streets, like little chellovecks made out of tin and with a spring inside and then a winding handle on the outside and you wind it up grrr grrr grrr and off it itties, like walking, O my brothers. But it itties in a straight line and bangs straight into things bang bang and it cannot help what it is doing. Being young is like being like one of these malenky machines.

Link to comment
Share on other sites

I have attempted to simplify the original script by simply launching an 'installer' with domain-admin rights... the following code is compiled to an .exe and placed on a server share--

It is then launched on a client workstation that begins the 'setup.exe' install process-- this fails out due to insufficient rights...

I had done a very simple version of this in the past with 'RunAsSet' -- it seems a bit of a bear since that command has been removed...

Any further help please?

=========================

Local $user = "username"

Local $domain = "domain-name"

Local $pass = "password"

RunAs($user, $domain, $pass,0,@ScriptName & "\setup.exe",@ScriptDir & "\\mis\NetAdmin\Installers\Cutsheet Archive App\Lookup Cutsheet\CutsheetLookup\Debug\")

Run("\\mis\NetAdmin\Installers\Cutsheet Archive App\Lookup Cutsheet\CutsheetLookup\Debug\setup.exe")

If Not IsAdmin() Then

RunAs($user, $domain, $pass, 0, @ScriptName & "\setup.exe", @ScriptDir & "\\mis\NetAdmin\Installers\Cutsheet Archive App\Lookup Cutsheet\CutsheetLookup\Debug\")

;rerun program with admin credentials

Exit

EndIf

=========================

thanks!

Link to comment
Share on other sites

Examples.

Script 1.

#cs ----------------------------------------------------------------------------
     
      Author:
         DaveF
     
      Script Function:
         Example of RunAs with file on a network share.
         Script 1 of 2
     
     #ce ----------------------------------------------------------------------------
     
    ; This script will be compiled into the initial EXE file called from
    ; the network share by the non-privileged, interactive user's session.
    ; The pre-compiled second-stage script must be present in this script's
    ; folder at compile time, and this script must of course be recompiled
    ; if changes are made to the second-stage script.
     
    ; Copy embedded, second-stage compiled script to TEMP folder.
     FileInstall("privileged-installer.exe", @TempDir & "\privileged-installer.exe", 1)
     
    ; Run second-stage script.
     RunAsWait("adminuser", "domain", "adminpass",  1, @TempDir & "\privileged-installer.exe", @TempDir)
     
    ; Clean up second-stage script.
     FileDelete(@TempDir & "\privileged-installer.exe")

Script 2, assumed in this example to be compiled as privileged-installer.exe.

#cs ----------------------------------------------------------------------------
       
        Author:
           DaveF
       
        Script Function:
           Example of RunAs with file on a network share.
           Script 2 of 2
       
       #ce ----------------------------------------------------------------------------
       
      ; This script will be compiled into the second-stage EXE
      ; which will be FileInstall-embedded in the initially called
      ; script, which will likely reside on a network share.
      ; The EXE for this script is being temporarily installed on
      ; the user's local PC so that the run-as user can access the
      ; EXE without network access (which won't exist at process
      ; spawn time).
       
       Dim $ourMap
       
      ; Establish temporary network connection to network share
      ; Though we're using the DriveMapAdd we don't have to
      ; designate a drive letter.
       $ourMap = DriveMapAdd("", "\\mis\NetAdmin", 0, "userWithAccessToShare", "userpass")
       
      ; Test for success in mapping the drive before continuing.
       If Not $ourMap Then
          ; Network connection failed.
          ; We could take action based on the
          ; value left in @error by DriveMapAdd
       Else
          ; Network connection succeeded, continuing.
           Run("\\mis\NetAdmin\Installers\Cutsheet Archive App\Lookup Cutsheet\CutsheetLookup\Debug\setup.exe")
       EndIf

Yes yes yes, there it was. Youth must go, ah yes. But youth is only being in a way like it might be an animal. No, it is not just being an animal so much as being like one of these malenky toys you viddy being sold in the streets, like little chellovecks made out of tin and with a spring inside and then a winding handle on the outside and you wind it up grrr grrr grrr and off it itties, like walking, O my brothers. But it itties in a straight line and bangs straight into things bang bang and it cannot help what it is doing. Being young is like being like one of these malenky machines.

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