Page 1 of 1 1
Topic Options
#192153 - 2009-02-10 11:26 PM I need to run script as administrator
Gee Offline
Fresh Scripter

Registered: 2009-02-04
Posts: 48
Loc: illinois
 Code:
$progdir1 = READVALUE("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion","ProgramFilesDir")
  IF EXIST ("$progdir\Symantec\Symantec Endpoint Protection\Rtvscan.exe") 
  GoTo Skip
ENDIF	
;Uninstall old SAV / Install of Symantec Endpoint Protection
  $progdir = READVALUE("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion","ProgramFilesDir")
?
?"Verifying if Symantec Anti-Virus is installed"
?
IF EXIST ("$progdir\Symantec AntiVirus\Rtvscan.exe") 
  $fileversion = GetFileVersion("$progdir\Symantec AntiVirus\Rtvscan.exe", "FileVersion" )
  if $fileversion <= "10.1.5.5000"
?"Found Symantec 10.0 ...... Uninstalling Symantec Antivirus"
  $PSW = "HKLM\SOFTWARE\Intel\LANDesk\VirusProtect6\CurrentVersion\AdministratorOnly\Security"
  $ = WriteValue ($PSW,"LockUnloadServices","0","REG_DWORD")
  $ = WriteValue ($PSW,"UseVPUninstallPassword","0","REG_DWORD")
;Uninstall command
  SHELL "MsiExec.exe /norestart /q/x{productid} REMOVE=ALL"
ENDIF
?
? "Installing Symantec EndPoint Protection ... This will take a few minutes."
?
  SHELL "\\AMTAAPP01\SEP-CLINST\setup.exe"
:Skip


exit ;quits the login script


Edited by Benny69 (2009-02-11 01:29 PM)
Edit Reason: Added Code Tags

Top
#192154 - 2009-02-10 11:42 PM Re: I need to run script as administrator [Re: Gee]
Gargoyle Offline
MM club member
*****

Registered: 2004-03-09
Posts: 1597
Loc: Valley of the Sun (Arizona, US...
Do a search for "runnas" Please note the double n is not a typo.
_________________________
Today is the tomorrow you worried about yesterday.

Top
#192170 - 2009-02-11 04:10 PM Re: I need to run script as administrator [Re: Gargoyle]
Gee Offline
Fresh Scripter

Registered: 2009-02-04
Posts: 48
Loc: illinois
i did do a search but i am still confused. I am just starting to learn kixtart. I would really apreciate any help if it's possible.
Top
#192172 - 2009-02-11 05:51 PM Re: I need to run script as administrator [Re: Gee]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4401
Loc: New Jersey
Once again, running a process with elevated rights during a login script will violate most security policies at any reputable company. (and possibly even at a few that aren't ;\) ) If your users aren't local admins, there's probably a good reason for it.

Using the task scheduler, you can create a task, define credentials for the task, and then trigger that task, all without the user having elevated rights. You can call a tokenized script from your login process so the logic to create the task, along with the credentials, is obsured from prying eyes.

The process becomes:
 Code:
Login script runs..
  batch file to perform admin task copied to workstation, uses generic name
  Script to create scheduled task is called
   Task created
   Task executed - runs the batch file with specific account
  Sub-script ends
Login script ends

The advantage is that the task with the elevated rights runs in a separate context, not in the user context. This makes it easy to do and quite safe.

You need to look for the tcLib UDF library for this to work. The SchedTask UDF provides a simple method to create scheduled tasks, but does not have the granular control to create & execute triggerless tasks. There is full documentation in the zip with example scripts.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#192173 - 2009-02-11 06:06 PM Re: I need to run script as administrator [Re: Glenn Barnas]
Gee Offline
Fresh Scripter

Registered: 2009-02-04
Posts: 48
Loc: illinois
how do i make the script run though. kix32.exe is on another computer. how do i make script.kix get called when i use the task schedule
Top
#192175 - 2009-02-11 07:32 PM Re: I need to run script as administrator [Re: Gee]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4401
Loc: New Jersey
Have you downloaded the UDF package, read the docs, and reviewed the example code? You should also review the forums, because this was discussed in fair detail with many examples about 2-3 months ago.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#192176 - 2009-02-11 07:35 PM Re: I need to run script as administrator [Re: Glenn Barnas]
Gee Offline
Fresh Scripter

Registered: 2009-02-04
Posts: 48
Loc: illinois
Glenn thank you for your help. i am very new to this so excuse my questions. how would i do runnas in my script i just need to run it once and then i can take out the runnas part. where would i plug in the runnas part in my code. and what do i put in.
Top
#192177 - 2009-02-11 08:58 PM Re: I need to run script as administrator [Re: Gee]
Gee Offline
Fresh Scripter

Registered: 2009-02-04
Posts: 48
Loc: illinois
please anyone ?
Top
#192179 - 2009-02-12 12:44 AM Re: I need to run script as administrator [Re: Gee]
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Just run this as a GPO startup script.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#192200 - 2009-02-12 06:36 PM Re: I need to run script as administrator [Re: Les]
Gee Offline
Fresh Scripter

Registered: 2009-02-04
Posts: 48
Loc: illinois
i can't run the script startup it's either log on or log off. where in my scripts will i be able to put RUNAS administrator. Don't you guys think that would work through GPO
Top
#192228 - 2009-02-12 11:51 PM Re: I need to run script as administrator [Re: Gee]
Gee Offline
Fresh Scripter

Registered: 2009-02-04
Posts: 48
Loc: illinois
ssue is closed. Thanks for your help i just ran it as a shutdown script. i needed a reboot anyway after the install.

Thanks a million.

Top
Page 1 of 1 1


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
1 registered (Allen) and 1198 anonymous users online.
Newest Members
M_Moore, BeeEm, min_seow, Audio, Hoschi
17883 Registered Users

Generated in 0.062 seconds in which 0.025 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org