Jump to content

Recommended Posts

Posted (edited)
If @OSArch = "X64" and @OSVersion = "WIN_7" Then
        RunWait(@ComSpec & " /c " & 'net stop pcasvc', "", @SW_HIDE)
        FileChangeDir("%systemroot%\sysnative")
        $CheckScreenSaverVer = RegRead("HKLM\Software\LANDesk", "ScreenSaverVersion")
        If $CheckScreenSaverVer = "MySSv2" Then Exit
        If FileExists("my.scr") Then FileDelete("my.scr")
        FileCopy(@ScriptDir & "\my.scr", "%systemroot%\sysnative\my.scr", 1)
        FileChangeDir("%systemroot%\syswow64")
        If FileExists("my.scr") Then FileDelete("my.scr")
        FileCopy(@ScriptDir & "\my.scr", "%systemroot%\syswow64\my.scr", 1)
        DllCall("kernel32.dll", "int", "Wow64DisableWow64FsRedirection", "int", 1)
        RegWrite("HKLM" & "\Software\LANDesk", "ScreenSaverVersion", "REG_SZ", "MySSv2")
        RunWait(@ComSpec & " /c " & 'net start pcasvc', "", @SW_HIDE)
        Exit
EndIf

This is working except the DLL call to disable folder re-direction is not working and the entry is going to the wrong place in the registry. It is right before the RegWrite command. At the top of the script I have #RequireAdmin. While I think the RegRead is working I am not entirely sure about that. Any ideas as to why the disable re-direct is not working?

Help and suggestions appreciated.

 

Edited by Briandr
Posted (edited)

I was able to get this fixed this line:

RegWrite("HKLM64" & "\Software\LANDesk", "ScreenSaverVersion", "REG_SZ", "MySSv2")

What I am after now is some basic logging from the the following line to a file:

$CheckScreenSaverVer = RegRead("HKLM\Software\LANDesk", "ScreenSaverVersion")
If $CheckScreenSaverVer = "MySSv2" Then Exit

I want to log to specific location and I tried checking for the quickest and simplest way to log the result. Can anyone help here?

 

Edited by Briandr
  • 3 weeks later...
Posted (edited)

Hi.

You could use a INI File on a network share to write such results to specific "result sections".

$Ini="\\Server\ShareToWriteTo\Path\MyMonitor.ini"

; do your checking, set $Result to e.g. "okay", "outdated", "not installed", <version-number>, ...



$aSections=IniReadSectionNames($Ini)


$sect=$Result
$key=@ComputerName
$Value="some descriptive text, timestamp, ..."


; clear up old results
for $i = 1 to $aSections[0]
    IniDelete($Ini,$sect,$key)
Next

; write current result
IniWrite($ini,$sect,$key,$Value)

Regards, Rudi.

Edited by rudi
syntax relevant typo

Earth is flat, pigs can fly, and Nuclear Power is SAFE!

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...