+ Post New Thread
Results 1 to 9 of 9
Windows Thread, Run Script as Administrator in Technical; We have received 3 update files in the form of .msp packages. I have written a piece of script to ...
  1. #1

    Join Date
    Nov 2006
    Location
    Lincoln
    Posts
    4
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Run Script as Administrator

    We have received 3 update files in the form of .msp packages. I have written a piece of script to run all three passivly and it works. However it will only run as an administrator. Is there a way either through login scripts or through the loginscript element of group policies to make the script work, either on its own or by forcing it to run as administrator/system?

    Thanks

    Tom

  2. #2

    Ric_'s Avatar
    Join Date
    Jun 2005
    Location
    Boston, MA
    Posts
    7,601
    Thank Post
    110
    Thanked 771 Times in 599 Posts
    Rep Power
    183

    Re: Run Script as Administrator

    The whole point of a .MSP file is to update an administrative install of a product. If you simply apply the .MSP to the admin install point, your clients (which have installed the app using a .MSI via GPO) will automagically upgrade without needing a script.

  3. #3
    ajbritton's Avatar
    Join Date
    Jul 2005
    Location
    Wandsworth
    Posts
    1,632
    Thank Post
    23
    Thanked 75 Times in 45 Posts
    Rep Power
    35

    Re: Run Script as Administrator

    Quote Originally Posted by Ric_
    The whole point of a .MSP file is to update an administrative install of a product. If you simply apply the .MSP to the admin install point, your clients (which have installed the app using a .MSI via GPO) will automagically upgrade without needing a script.
    Not quite! An MSP can be used to patch an Admin install point, or an installed application. Assuming the application has been installed from an admin installation point and the patch subsequently applied to that install point, then the application would need 're-cacheing' on the PC, using a command like...

    msiexec /i [path to updated .msi file on the administrative image] REINSTALL=ALL REINSTALLMODE=vomu /qb

    I suppose this could be done with a Startup Script.

    It may also be possible to select the 'redeploy application' action on an assigned MSI but I don't know exactly what effect this would have.

  4. #4
    ChrisH's Avatar
    Join Date
    Jun 2005
    Location
    East Lancs
    Posts
    5,007
    Thank Post
    124
    Thanked 286 Times in 263 Posts
    Rep Power
    109

    Re: Run Script as Administrator

    Quote Originally Posted by ajbritton
    It may also be possible to select the 'redeploy application' action on an assigned MSI but I don't know exactly what effect this would have.
    It does what it says it says on the tin!

  5. #5
    ajbritton's Avatar
    Join Date
    Jul 2005
    Location
    Wandsworth
    Posts
    1,632
    Thank Post
    23
    Thanked 75 Times in 45 Posts
    Rep Power
    35

    Re: Run Script as Administrator

    Quote Originally Posted by ChrisH
    Quote Originally Posted by ajbritton
    It may also be possible to select the 'redeploy application' action on an assigned MSI but I don't know exactly what effect this would have.
    It does what it says it says on the tin!
    OK, so is that an un-install followed by a reinstall, or a repair, or a re-cache? I've seen differing behaviour from this action, depending on the MSI file.

  6. #6

    Join Date
    Feb 2006
    Posts
    1,187
    Thank Post
    0
    Thanked 1 Time in 1 Post
    Rep Power
    0

    Re: Run Script as Administrator

    Quote Originally Posted by TSCNUK
    We have received 3 update files in the form of .msp packages. I have written a piece of script to run all three passivly and it works. However it will only run as an administrator. Is there a way either through login scripts or through the loginscript element of group policies to make the script work, either on its own or by forcing it to run as administrator/system?

    Thanks

    Tom

    If for some reason you can persue the GPO installtion as per ChrisH and ajbritton then your best bet is a startup script. This will have admin privilidges. Alternative you can set a scheduled job on the target computers to run the script. This will aslo be procesed with admin powers.

    The last option might be to use the EXE packager in AdminScriptEditor to created an encrypted executable. This would allow you to place an explitict run as command in you script with a plain text admin password.

  7. #7
    ajbritton's Avatar
    Join Date
    Jul 2005
    Location
    Wandsworth
    Posts
    1,632
    Thank Post
    23
    Thanked 75 Times in 45 Posts
    Rep Power
    35

    Re: Run Script as Administrator

    The trick with running a seperate script will be to make sure the script only runs once. There are many ways of doing this, but basically what is needed is some kind of 'flag' on the target PCs. The script should check for the presence of the flag before running the update. If the flag is not present, then the update may be run and the flag set to prevent future runs of the script.

    example CMD script

    Code:
    rem Check for flag
    if exist C:\AppName_Update_X.txt then goto jExit
    rem - add script code here to install Update X for AppName
    
    rem - Add the flag
    echo Update X installed at %TIME% on %DATE% > C:\AppName_Update_X.txt
    :jExit

  8. #8

    Join Date
    Feb 2006
    Posts
    1,187
    Thank Post
    0
    Thanked 1 Time in 1 Post
    Rep Power
    0

    Re: Run Script as Administrator

    You could also have markers in the registry using the REG command (or KiX or VBS/JS) but the main problem remains how to how run with elevated privilidges with out having clear text logon details readable by non-tech users.

  9. #9
    ajbritton's Avatar
    Join Date
    Jul 2005
    Location
    Wandsworth
    Posts
    1,632
    Thank Post
    23
    Thanked 75 Times in 45 Posts
    Rep Power
    35

    Re: Run Script as Administrator

    Quote Originally Posted by NetworkGeezer
    the main problem remains how to how run with elevated privilidges with out having clear text logon details readable by non-tech users.
    Assuming you have Active Directory, then a Startup Script will do it as you pointed out.



SHARE:
+ Post New Thread

Similar Threads

  1. Logon script & Printer script question.
    By Galway in forum Windows
    Replies: 3
    Last Post: 29th August 2007, 12:00 PM
  2. Replies: 8
    Last Post: 12th November 2006, 03:02 PM
  3. Administrator Account
    By Gatt in forum Windows Vista
    Replies: 0
    Last Post: 2nd April 2006, 10:51 AM
  4. Allow non-administrator accounts to unlock a pc
    By richard in forum How do you do....it?
    Replies: 17
    Last Post: 11th March 2006, 11:36 PM
  5. Top 10 System Administrator Truths
    By Geoff in forum Jokes/Interweb Things
    Replies: 1
    Last Post: 5th December 2005, 01:06 PM

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
  •