Page 1 of 1 1
Topic Options
#201921 - 2011-04-19 10:53 PM Kix-461 can't seem to debug Issue on Windows 7 64 Bit
cmptrguy1 Offline
Just in Town

Registered: 2011-03-11
Posts: 4
Loc: Alabama
Cant seem to get the
------------
 Code:
;Declared Variables
$RTRNSOPHOS3 = EXIST ("%ProgramFiles%\Sophos\Sophos Anti-Virus\SavService.exe")
$RTRNSOPHOS4 = EXIST ("%ProgramFiles(x86)%\Sophos\Sophos Anti-Virus\SavService.exe")

$RTRNSOPHOS3PATH = "%ProgramFiles%\Sophos\Sophos Anti-Virus\"
$RTRNSOPHOS4PATH = "%ProgramFiles(x86)%\Sophos\Sophos Anti-Virus\"

;************************************************************
;** Check OS version for Token File Placement Then Create  **
;************************************************************
;Check Which OS Version is Installed
$Handle = FreeFileHandle()
IF $Handle > 0
  If $RTRNSOPHOS3 = 1
    IF Open($Handle, $RTRNSOPHOS3PATH + "Alto-INS-Track.txt", 5) = 0 
       ;at (14,5) "RTRNSOPHOS3 $RTRNSOPHOS3PATH + "Alto-INS-Track.txt""
       goto FILETOKEN
    ENDIF
  ELSE
  IF $RTRNSOPHOS4 = 1
    IF Open($Handle, $RTRNSOPHOS4PATH + "Alto-INS-Track.txt", 5) = 0       goto FILETOKEN
    ENDIF
  ENDIF
  ENDIF
Else 
  goto  End_sub
ENDIF


Edited by Allen (2011-04-20 12:57 AM)
Edit Reason: added code tags

Top
#201922 - 2011-04-19 10:55 PM Re: Kix-461 can't seem to debug Issue on Windows 7 64 Bit [Re: cmptrguy1]
cmptrguy1 Offline
Just in Town

Registered: 2011-03-11
Posts: 4
Loc: Alabama
sorry for this I am new to this forum I hit the wrong key and it posted the part I am having trouble with is the open file with the $RTRNSOPHOS4
on windows 7 64 Bit it returns an error code of 5 which I can't find documented. I am at a loss if someone could point me in the correct direction I woudl be thankfull.

Top
#201923 - 2011-04-19 11:13 PM Re: Kix-461 can't seem to debug Issue on Windows 7 64 Bit [Re: cmptrguy1]
ShaneEP Moderator Offline
MM club member
*****

Registered: 2002-11-29
Posts: 2125
Loc: Tulsa, OK
Well...A return code of 5 usually means "access denied". My guess is that the line $RTRNSOPHOS4PATH = "%ProgramFiles(x86)%\Sophos\Sophos Anti-Virus\" is not populating correctly. Have you tried placing some ? lines to verify your info is getting passed along correctly? For example...

 Code:
;Declared Variables
$RTRNSOPHOS3 = EXIST ("%ProgramFiles%\Sophos\Sophos Anti-Virus\SavService.exe")
$RTRNSOPHOS4 = EXIST ("%ProgramFiles(x86)%\Sophos\Sophos Anti-Virus\SavService.exe")

? "RTRNSOPHOS3: "+$RTRNSOPHOS3
? "RTRNSOPHOS4: "+$RTRNSOPHOS4

$RTRNSOPHOS3PATH = "%ProgramFiles%\Sophos\Sophos Anti-Virus\"
$RTRNSOPHOS4PATH = "%ProgramFiles(x86)%\Sophos\Sophos Anti-Virus\"

? "RTRNSOPHOS3PATH: "+$RTRNSOPHOS3PATH
? "RTRNSOPHOS4PATH: "+$RTRNSOPHOS4PATH

Top
#201924 - 2011-04-20 01:08 AM Re: Kix-461 can't seem to debug Issue on Windows 7 64 Bit [Re: ShaneEP]
Allen Administrator Online   shocked
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4548
Loc: USA
It could be permissions, as well as the UAC being turned on.

A simpler way of coding would be something like (untested)
 Code:
if exist(programfilesx86()+"\Sophos\Sophos Anti-Virus\")
  ;do stuff
endif

function programfilesx86()
  $programfilesx86=iif(@onwow64,"%programfiles(x86)%","%programfiles%")
endfunction

Top
#201930 - 2011-04-20 03:40 PM Re: Kix-461 can't seem to debug Issue on Windows 7 64 Bit [Re: Allen]
cmptrguy1 Offline
Just in Town

Registered: 2011-03-11
Posts: 4
Loc: Alabama
It could be UAS for sure but how do I get around that.
It works fine on most Win 7 32 bit Versions
Also as I was debugging the Paths (Yes they are populating correctly, I have used the ? and the AT commeand extensively in the Script.)
I noticed if I create a Folder C:\Temp lets say I can open the file in and write to that.
The problem is that for Sophos AV install it would be better if I could create the file in the product home Folder.
I will try the suggestions

Please note I am executing these scripts with the Runnas.exe program as the Domain\Administrator So I can't figure out why permissions would be a problem UAC maybe
Thanks again

Top
#201931 - 2011-04-20 04:08 PM Re: Kix-461 can't seem to debug Issue on Windows 7 64 Bit [Re: cmptrguy1]
cmptrguy1 Offline
Just in Town

Registered: 2011-03-11
Posts: 4
Loc: Alabama
Also I have noticed as a standard user it appears they do not have access to create a file under either Progam File Folder
I am checking to see what kind of access the Domain\Admin USer has on the Box.

Top
#201932 - 2011-04-20 04:20 PM Re: Kix-461 can't seem to debug Issue on Windows 7 64 Bit [Re: cmptrguy1]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4396
Loc: New Jersey
Couple of things..
1. post the entire script - we might see something that isn't visible in your snippet
2. Try running the script while logged in as a domain admin. If it works there, you will know the logic is OK and need to focus on access.
3. If the Domain Admin account fails, use the local admin account. Domain Admins have just slightly less access than "the local administrator" on Windows 7.
4. Trying to elevate access during login is tricky, and usually frowned upon by security organizations. There is an example in the script vault for triggering processes that you can get some specific ideas from. What we do is have the user determine if an admin task is needed. Users generally can read anything. If something is missing or a lower version, a file can be written to a central server which identifies the client and the task. The server can push an install script to the client, create a scheduled task with specific local or domain credentials, and then immediately trigger the task. In most csaes, we can trigger admin-processed installs on client workstations within 15 seconds of a user logging in. No user or task rights elevation required and no issue with UAC.

There is an entire library of task scheduling udfs (tcLib) on our web site that can implement the remote task define & trigger process. We've deployed this at several client sites, from a few dozen users to sites with thousands of users.

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

Top
Page 1 of 1 1


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

Who's Online
1 registered (Allen) and 313 anonymous users online.
Newest Members
Jojo67, MaikSimon, kvn317, kixtarts2025, SERoyalty
17873 Registered Users

Generated in 0.145 seconds in which 0.102 seconds were spent on a total of 14 queries. Zlib compression enabled.

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