vbscript windows xp warning message based on date - vbscript

I would like windows XP to have a running script that checks the "date modified" of files as they are opened and give the user a warning message if the date matches between 1/1/11 to 7/15/14. The files might have no extension, a .pm5 extension, a .nc extension or a .drl extension. I'm not concerned with any other file extensions.
Ive found help how to create a .vbs windows message box, I found help how to check for date modified but not how to check any file with listed extension being opened and give a warning message.
thank you all

There is no feature for this in script. So you need a vb.net program using a filewatcher object. You can make vb.net programs on your computer with notepad. See here for the principal http://social.msdn.microsoft.com/Forums/en-US/adcae113-4758-481a-a367-60d5d14d97d6/this-is-how-to-turn-vbs-and-js-files-into-exe-files-from-the-command-line-without-third-party-tools?forum=scripting.
You could turn on auditing of files, set the containing folders to audit files (note two steps to audit something). An security event will be written to event log.
Task Scheduler can run tasks based on event log messages.

Related

wscript.exe stopped working with a custom protocol

All the computers in our company are configured with a custom protocol that runs a vbs script, so when you click on a link with that user protocol, the vbs script starts and performs operations that interact with the file system and applications otherwise inaccessible to the browser.
This is the .reg file used to register the protocol:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\<name>]
"URL Protocol"=""
#="Url:<Description>"
"UseOriginalUrlEncoding"=dword:00000001
[HKEY_CLASSES_ROOT\<name>\DefaultIcon]
#="C:\\Windows\\System32\\WScript.exe"
[HKEY_CLASSES_ROOT\<name>\shell]
[HKEY_CLASSES_ROOT\<name>\shell\open]
[HKEY_CLASSES_ROOT\<name>\shell\open\command]
#="C:\\Windows\\System32\\WScript.exe \"C:\\Program Files\\<name>.vbs\" \"%1\""
The script has worked beautifully since 2014 without problems on ~50 computers.
Last week one user complained that it stopped working. I found out that WScript.exe doesn't work anymore, so I copied it creating WScript2.exe, modified the custom protocol to run WScript2.exe and it restarted working.
This morning also my computer didn't listen to the clicks on my custom protocol. I made a copy of WScript.exe to WScript2.exe and it restarted working.
I am expecting my phone to start ringing soon.
Why did WScript.exe stop listening to the custom protocol?
Why its identical copy still works?
EDIT (answers to comments)
Perhaps if I knew how to better describe "it stopped working" then I would know how to fix it :)
I don't know if it stopped working because of a Microsoft update, an anti-virus update or a change on the IT infrastructure/configuration. Here is a quick summary of what led me to the workaround:
I compared my custom protocol to a working one, I picked mailto as a reference
I noticed that changing the last line of the .reg file (see above) it would work with any other executable, but it wouldn't work with wscript.exe
I compared the execution of wscript.exe on the affected computers to its execution on computers (not yet) affected and there is no difference
A double click shows the same Windows Script Host Settings dialog
The execution from a command prompt with the same arguments used by the custom protocol works as expected
The custom protocol passes the correct arguments when executing another executable
At this point I thought that Windows blacklisted wscript.exe and I started searching for an alternative
I tried to rename wscript.exe to wscript2.exe but I couldn't because I don't have TrustedInstaller permission
I made a copy instead of renaming it
I tested the copy from the command prompt and it was working like the original
I tested the copy from the custom protocol and it was working like the original once did
EDIT 2 (more answers to comments)
All the computers have Windows 10 Pro.
Clicking on Settings - Updates & Security - View update history it says Feature update to Windows 10, version 1803 Succesfully installed on 5/22/2018. Clicking on Show what's new in this update shows nothing useful.
EDIT 3
Doesn't work = no symptoms, nothing happens, nothing is executed, nothing is logged (as far as I know).
I tried with a simple vbscript with a single line MsgBox "Hello". It works running it from the command line, but it doesn't work from the custom protocol. The task manager doesn't show anything popping up, but I don't know if it doesn't show it because the lifespan is too short to show or because it doesn't execute. The same script works with wscript2.exe.
My feeling is that something (Windows, anti-virus, ...) is blacklisting the custom protocol + wscript.exe thing, but not the custom protocol + any other executable or any other environment + wscript.exe. That's why I tried to copy wscript.exe to wscript2.exe. And I was pleasantly surprised to find out that it works.

MSI installer creates unattended shell open key

I created an MSI installer project in VS2015, set up everything, then added a file extension associtation with the "File Types Editor", assigned my extension to my application, as an Open command.
The COMMAND was the application from the "application folder", the EXTENSION was set, then the &OPEN was set as NAME=&Open, Arguments="%1" VERB=open. Nothing else.
I generated the .msi file, then started. At the end of the installation, I found out that in the registry Computer\HKEY_CLASSES_ROOT\\shell\open\command key there were two item, one is (Default) REG_SZ with value "myexe" "%1" as I expected
Unfortunately there was another item: "command", "REG_MULTI_SZ" and the Data was something weird, for example "LZ*a!t4(v=++Tt$)tOk_>[1jfrS!,nB`L6ciHLW!, "%1"" which I don't know what it is. When I delete the .msi file, and double click on a file with my registered extension, a popup dialog appears as "network resource cannot be found" and Windows wants my .msi installer back (browse dialog comes in)! I don't know how to prevent this unwanted situation. :( Any help would be highly appreciate!
Windows Installer uses so-called Darwin Descriptors to implement resiliency, wherein a corrupted installation can be repaired automatically. Your attempt to delete the .msi rather than to uninstall it acts like a corrupted installation, so the system attempts to fix it. However, since the .msi itself has been removed, it has to ask for help.
The short answer here is to suggest that you not worry about the exact values in the registry key. Since you're using an Extension table instead of a Registry table entry, the registry is an implementation detail; you should prefer to ignore such detail. Instead, if after a successful installation your program launches as expected upon double clicking the associated file, and it stops doing so after properly uninstalling your application, all is well.

Dynamically changing file lock/access permissions on open file

I have a client application where we try to check files in and out from SharePoint for editing. I am using SharePoint's SOAP interfaces and some FrontPage interfaces to do this. It used to work fine under SharePoint 2007, but with 2010 I can't check out or check in a file if I have the file open for editing. I get a message like "FileXXX is locked for exclusive use by DOMAIN\user" when I examine the returned error message. I also cannot update any of the user defined SharePoint fields for a file/list if the file is open for editing.
My question is this: Is there a way to change the access/lock for an open file to make it non-exclusive temporarily and then restore it?
Note: Some of my data files are opened using windows file handles (flat files) and others are opened using windows structured storage (compound document files).
This may not work for Sharepoint specifically, but the ReOpenFile() API does what you want. I don't know of any other way to do this.
http://msdn.microsoft.com/en-us/library/windows/desktop/aa365497(v=vs.85).aspx

Same BAT file behaving differently when called from Desktop or from within a Program

I'm using Windows 7. I want to trigger a BAT file to run once some sound happens.
The BAT file should trigger a Skype call.
For that, I'm using the following BAT command:
c:\"Program Files"\Skype\Phone\skype /callto:someUsername
Skype should be already running before the trigger. If I double-click this BAT file on my desktop, it will run smoothly, pop up Skype, and start the call.
Now I'm using ISpy software to trigger the BAT file over a specified sound threshold.
ISpy is working fine. It detects the sound and triggers the BAT file.
But when the BAT file starts running, instead of popping up Skype it tries to load a new Skype instance.
Is there a context difference between calling BAT file with double click or within ISpy?
How can I overcome this?
#PaulojFonseca hasn't checked in since one day after this post, meaning Oct 29, 2012, so he won't likely come back to post his answer. Even though he won't be here to accept his own answer, I'll post it so at least it will show up. I've edited it to make the answer easier to read without much context.
"... when running ISpy, ... not all permissions [that were needed were] enabled. If i change this in the security preferences than the batch file runs smoothly."

Expression Web: Shortcut doesn't point to an exe file, but I want to use it to edit

Problem: I have to support users who need to edit web pages. Some of these web pages exist only as textarea controls. Fortunately, there is a firefox plugin that allows the user to open the textarea in a default text editor. Unfortunately, this plugin requires you to point to the EXE file of the text editor you want to invoke.
This is a reasonable requirement, but ##$%^ Microsoft Expression Web is one of those applications whose shortcut .lnk file does not appear to point to a real EXE file. If there is an EXE file somewhere, it's hidden.
Question:
How can I locate the actual EXE file so people can configure Microsoft Expression web to be their editor of choice?
Update: I should have emphasized that I was looking for a way to automate this via script or batch file (hence the SO posting, in case anyone's "not-programming-related" spidey sense was tingling).
I found my executable in the following location:
C:\Program Files\Microsoft Expression\Web Designer\EXPRWD.EXE
I'm not sure if that gives you what you need, but you can always have your users (or programmatically) search for EXPRWD.EXE and go from there.

Resources