VBSCript Event Log Queries





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







0















I'm trying to create a script to disable the IE proxy through the registry.



I want the script to write an event log after it runs. Before it runs ,it needs to check if the event exists. Here's what i've written:



'#  SCRIPT.........:  disable_proxy.vbs
'# AUTEUR.........: Sebastien Dion
'# VERSION........: 1.0
'# DATE_CREATION..: 2018-11-05
'# COPYRIGHT......: 2018
'# DESCRIPTION....: Désactive le proxy d'Internet Explorer
'============================================================
Const HKEY_CURRENT_USER = &H80000001
Dim regEx, Match, Matches
Dim text
Set objShell = CreateObject("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")
text = file.ReadAll
strEventWrite = "eventcreate /T INFORMATION /L APPLICATION /D " & Chr(34) & "Le proxy a été désactivé."
strSearchEvent = "wmic /namespace:\.rootcimv2 ntevent where (Message='Le proxy a été désactivé.') get Message > C:ProgramDataproxy_log.txt"
objShell.Run strSearchEvent
Set fso = CreateObject("Scripting.FileSystemObject")
Set file = fso.OpenTextFile("C:ProgramDataproxy_log.txt", 1)

Set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\.rootdefault:StdRegProv")

strKeyPath = "SoftwareMicrosoftWindowsCurrentVersionInternet Settings"
strValueName = "ProxyEnable"

objReg.GetDWORDValue HKEY_CURRENT_USER,strKeyPath,strValueName,dwValue

'#==============================================================================
'# Si le proxy est activé, le désactiver et
'# écrire un événement dans le journal Application.
'#==============================================================================
If dwValue = 1 Then
dwValue = 0
objReg.SetDWORDValue HKURRENT_USER,strKeyPath,strValueName,dwValue
objShell.Run strEventWrite

'#==============================================================================
'# Si le proxy est désactivé, écrire un événement dans le journal Application.
'#==============================================================================
ElseIf dwValue = 0 Then
objShell.Run strEventWrite


End If


The script doesn'T work, and i'm not sure of the logic to use to check for the event.



Thanks!










share|improve this question























  • "The script doesn't work" is a bit too vague. What exactly is happening (or isn't happening?) what have you already tried,...

    – Geert Bellekens
    Nov 23 '18 at 7:29


















0















I'm trying to create a script to disable the IE proxy through the registry.



I want the script to write an event log after it runs. Before it runs ,it needs to check if the event exists. Here's what i've written:



'#  SCRIPT.........:  disable_proxy.vbs
'# AUTEUR.........: Sebastien Dion
'# VERSION........: 1.0
'# DATE_CREATION..: 2018-11-05
'# COPYRIGHT......: 2018
'# DESCRIPTION....: Désactive le proxy d'Internet Explorer
'============================================================
Const HKEY_CURRENT_USER = &H80000001
Dim regEx, Match, Matches
Dim text
Set objShell = CreateObject("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")
text = file.ReadAll
strEventWrite = "eventcreate /T INFORMATION /L APPLICATION /D " & Chr(34) & "Le proxy a été désactivé."
strSearchEvent = "wmic /namespace:\.rootcimv2 ntevent where (Message='Le proxy a été désactivé.') get Message > C:ProgramDataproxy_log.txt"
objShell.Run strSearchEvent
Set fso = CreateObject("Scripting.FileSystemObject")
Set file = fso.OpenTextFile("C:ProgramDataproxy_log.txt", 1)

Set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\.rootdefault:StdRegProv")

strKeyPath = "SoftwareMicrosoftWindowsCurrentVersionInternet Settings"
strValueName = "ProxyEnable"

objReg.GetDWORDValue HKEY_CURRENT_USER,strKeyPath,strValueName,dwValue

'#==============================================================================
'# Si le proxy est activé, le désactiver et
'# écrire un événement dans le journal Application.
'#==============================================================================
If dwValue = 1 Then
dwValue = 0
objReg.SetDWORDValue HKURRENT_USER,strKeyPath,strValueName,dwValue
objShell.Run strEventWrite

'#==============================================================================
'# Si le proxy est désactivé, écrire un événement dans le journal Application.
'#==============================================================================
ElseIf dwValue = 0 Then
objShell.Run strEventWrite


End If


The script doesn'T work, and i'm not sure of the logic to use to check for the event.



Thanks!










share|improve this question























  • "The script doesn't work" is a bit too vague. What exactly is happening (or isn't happening?) what have you already tried,...

    – Geert Bellekens
    Nov 23 '18 at 7:29














0












0








0








I'm trying to create a script to disable the IE proxy through the registry.



I want the script to write an event log after it runs. Before it runs ,it needs to check if the event exists. Here's what i've written:



'#  SCRIPT.........:  disable_proxy.vbs
'# AUTEUR.........: Sebastien Dion
'# VERSION........: 1.0
'# DATE_CREATION..: 2018-11-05
'# COPYRIGHT......: 2018
'# DESCRIPTION....: Désactive le proxy d'Internet Explorer
'============================================================
Const HKEY_CURRENT_USER = &H80000001
Dim regEx, Match, Matches
Dim text
Set objShell = CreateObject("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")
text = file.ReadAll
strEventWrite = "eventcreate /T INFORMATION /L APPLICATION /D " & Chr(34) & "Le proxy a été désactivé."
strSearchEvent = "wmic /namespace:\.rootcimv2 ntevent where (Message='Le proxy a été désactivé.') get Message > C:ProgramDataproxy_log.txt"
objShell.Run strSearchEvent
Set fso = CreateObject("Scripting.FileSystemObject")
Set file = fso.OpenTextFile("C:ProgramDataproxy_log.txt", 1)

Set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\.rootdefault:StdRegProv")

strKeyPath = "SoftwareMicrosoftWindowsCurrentVersionInternet Settings"
strValueName = "ProxyEnable"

objReg.GetDWORDValue HKEY_CURRENT_USER,strKeyPath,strValueName,dwValue

'#==============================================================================
'# Si le proxy est activé, le désactiver et
'# écrire un événement dans le journal Application.
'#==============================================================================
If dwValue = 1 Then
dwValue = 0
objReg.SetDWORDValue HKURRENT_USER,strKeyPath,strValueName,dwValue
objShell.Run strEventWrite

'#==============================================================================
'# Si le proxy est désactivé, écrire un événement dans le journal Application.
'#==============================================================================
ElseIf dwValue = 0 Then
objShell.Run strEventWrite


End If


The script doesn'T work, and i'm not sure of the logic to use to check for the event.



Thanks!










share|improve this question














I'm trying to create a script to disable the IE proxy through the registry.



I want the script to write an event log after it runs. Before it runs ,it needs to check if the event exists. Here's what i've written:



'#  SCRIPT.........:  disable_proxy.vbs
'# AUTEUR.........: Sebastien Dion
'# VERSION........: 1.0
'# DATE_CREATION..: 2018-11-05
'# COPYRIGHT......: 2018
'# DESCRIPTION....: Désactive le proxy d'Internet Explorer
'============================================================
Const HKEY_CURRENT_USER = &H80000001
Dim regEx, Match, Matches
Dim text
Set objShell = CreateObject("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")
text = file.ReadAll
strEventWrite = "eventcreate /T INFORMATION /L APPLICATION /D " & Chr(34) & "Le proxy a été désactivé."
strSearchEvent = "wmic /namespace:\.rootcimv2 ntevent where (Message='Le proxy a été désactivé.') get Message > C:ProgramDataproxy_log.txt"
objShell.Run strSearchEvent
Set fso = CreateObject("Scripting.FileSystemObject")
Set file = fso.OpenTextFile("C:ProgramDataproxy_log.txt", 1)

Set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\.rootdefault:StdRegProv")

strKeyPath = "SoftwareMicrosoftWindowsCurrentVersionInternet Settings"
strValueName = "ProxyEnable"

objReg.GetDWORDValue HKEY_CURRENT_USER,strKeyPath,strValueName,dwValue

'#==============================================================================
'# Si le proxy est activé, le désactiver et
'# écrire un événement dans le journal Application.
'#==============================================================================
If dwValue = 1 Then
dwValue = 0
objReg.SetDWORDValue HKURRENT_USER,strKeyPath,strValueName,dwValue
objShell.Run strEventWrite

'#==============================================================================
'# Si le proxy est désactivé, écrire un événement dans le journal Application.
'#==============================================================================
ElseIf dwValue = 0 Then
objShell.Run strEventWrite


End If


The script doesn'T work, and i'm not sure of the logic to use to check for the event.



Thanks!







vbscript






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 22 '18 at 19:52









Seb DoeSeb Doe

1




1













  • "The script doesn't work" is a bit too vague. What exactly is happening (or isn't happening?) what have you already tried,...

    – Geert Bellekens
    Nov 23 '18 at 7:29



















  • "The script doesn't work" is a bit too vague. What exactly is happening (or isn't happening?) what have you already tried,...

    – Geert Bellekens
    Nov 23 '18 at 7:29

















"The script doesn't work" is a bit too vague. What exactly is happening (or isn't happening?) what have you already tried,...

– Geert Bellekens
Nov 23 '18 at 7:29





"The script doesn't work" is a bit too vague. What exactly is happening (or isn't happening?) what have you already tried,...

– Geert Bellekens
Nov 23 '18 at 7:29












0






active

oldest

votes












Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53437331%2fvbscript-event-log-queries%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53437331%2fvbscript-event-log-queries%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

mysqli_query(): Empty query in /home/lucindabrummitt/public_html/blog/wp-includes/wp-db.php on line 1924

How to change which sound is reproduced for terminal bell?

Can I use Tabulator js library in my java Spring + Thymeleaf project?