Windows 10 thinks VB Script is a virus - vbscript

I created a PHP web form that creates a vbscript which will download a specific file and install it. Everything works great and the project is done but now Windows 10 is automatically deleting the file once it's downloaded. Windows 10 thinks its a virus.
There's no malicious code but I do have the following code so that it runs as an admin:
If Not WScript.Arguments.Named.Exists("elevate") Then
CreateObject("Shell.Application").ShellExecute WScript.FullName _
, """" & WScript.ScriptFullName & """ /elevate", "", "runas", 1
WScript.Quit
End If
Is there anything I can do so that Windows 10 doesn't think a VBscript is a virus?
Thanks,

Related

Passing < or > to shell command?

I have the maintenance of an old software written in VB6 that I have had to change from MSAccess to mySQL. The program works by calling external database utility programs which redirect data to and from files using the shell.
While trying to write the new database backup and recovery functions I got a terrible surprise. It seems the angle brackets do not work when sending a commandline through SHELL function (p.e.):
Shell ("""" & mySQLdumpLocation & """" --defaults-file="""" & confFileLocation & """" nameofthedatabase > """" & backuplocation & """")
This instruction opened a command line window where the mysqldump output could be seen but it did not create the backupfile. When copying the same instruction to a cmd window it worked perfectly.
I noticed after many hours looking for information that changing the ">" keyword to -r made the job.
Now I'm facing the same problem withe the recovery of the backup. In theory I need to use this:
Shell ("""" & mysqlexeLocation & """" --defaults-file="""" & confFileLocation & """" nameofthedatabase < """" & backuplocation & """")
...and no, it does not work. It does nothing. The same instruction copied to cmd window works as expected... and I haven't found a substitute for the "<".
Does anyone know what is happening?

Starting program hidden from VBS script no longer works

I've been using this VBS to start a batch script hidden for over 2 years now with no issues:
Dim WinScriptHost
Set WinScriptHost = CreateObject("WScript.Shell")
WinScriptHost.Run Chr(34) & "C:\Dev\broker\boot\boot.cmd" & Chr(34), 0
Set WinScriptHost = Nothing
Two days ago I started my PC and this just stopped working. It calls the batch script but also shows a command prompt window. I did not fiddle with the OS in any way and I did not update it either. I'm on Windows 10 1903 build 18362.53 installed on 21th of March (a month ago).
What could have changed and how do I make the above script work again?

Failure to run VBS script with task scheduler

we have this vbs script we use to update certain documents with SyncToy.
This is the script as it is currently written:
'--------------------------------------------------
Set oShell = CreateObject("WScript.Shell")
sFilePath = chr(34) & "C:\Program Files\SyncToy 2.1\SyncToyCmd.exe" &
chr(34) & "-R"
iRC = oShell.Run(sFilePath, 0, True)
' Return with the same errorlevel as the batch file had
Wscript.Quit iRC
'---------------------------------------------------
I didn't write this script, and I have very little experience with scripting.
I have a task set up in task scheduler that runs this script anytime the device connects to a network. The script should run SyncToy and then synchronize the folder pair that is set up. I have tried running the script through command prompt with the cscript command but nothing happens as far as I can tell. At least the folders aren't syncing.
The script is running on a Windows 10 pro tablet
I have verified that the task is indeed running when it is supposed to. I'm just not sure if it is an issue with the way the script is written or if the task settings need to be changed. Is there anything wrong with the script as far as you can tell?
I was unsure whether to post this here or over in serverfault. If this doesn't belong here please move the question over to serverfault
Update: I've verified that this isn't a problem with the script. This problem apparently arose only after the update from SyncToy 2.0 to 2.1.
Thanks Guys.
There is a error with the sFilePath lines.
First, I don't know if this was originaly on a single line but it should (or add "_" before changing line).
Then, this (...)& >"-R" would not work. The ">" symbole is outside the quotes and generate a error.
If you want to execute this command: "C:\Program Files\SyncToy 2.1\SyncToyCmd.exe" -R,
this is the way to do this:
sFilePath = chr(34) & "C:\Program Files\SyncToy 2.1\SyncToyCmd.exe" & chr(34) & " -R"
You can also add msgbox sFilePath to show a popup with the value of sFilePath.
To test/run the script, you just need to double-click on it.

opening a file that's not in the same directory

I want to run a program (that is not in the same directory as the script) with a MSG box, here's the code (it doesen't work because it needs the program to be on desktop like the script)
puls = MsgBox("Want to open steam?", vbYesNo + vbQuestion)
if puls = vbYes then
CreateObject("WScript.Shell").Run "C:\Program Files(x86)\Steam\Steam.exe"
CreateObject("WScript.Shell").Run "C:\Users\Dario Loi\AppData\Local\TeamSpeak 3 Client\ts3client_win64.exe"
else
MsgBox "Okay :(", vbInformation
end if
now, as you can see, i want to execute this at system startup to get my gaming programs running, but i can't put steam on the desktop because it will dump it's assets there, and it would be a mess, i can't put the script in steam's directory too, same thing for TS3, also, i tried to replace the name of the file with it's path, but it does not work either
EDIT:
Just for making things clear, i've got a VBS File on my desktop, along with it, on the desktop i've got 2 links (not the original EXEs), to steam and TS, (the programs i want to run), i would want to open these 2 programs without putting the script and the program in the same folder, so
by making the script refer to the link and
by making the script refer to the path,
if you got ideas, please tell me
And if you try like this ?
puls = MsgBox("Want to open steam?", vbYesNo + vbQuestion)
Set ws = CreateObject("WScript.Shell")
if puls = vbYes then
ws.Run DblQuote("C:\Program Files(x86)\Steam\Steam.exe")
ws.Run DblQuote("C:\Users\Dario Loi\AppData\Local\TeamSpeak 3 Client\ts3client_win64.exe")
else
MsgBox "Okay :(", vbInformation
end if
'*****************************************
Function DblQuote(Str)
DblQuote = Chr(34) & Str & Chr(34)
End Function
'*****************************************
Add a cd (change directory) line to the full path of your executables which will bring the cmd prompt to that directory, and do your run command.

Run foxpro .prg with VBScript

well basically I have a bit of a problem and I'm at a block at the moment, I'm trying to use vbs to run a foxpro .prg file , normally I would have to right click the .prg then click run then foxpro ask me for the possessing date and stuff but i can use sendkeys for that i figured I don't mind if its not hidden any help will be greatly appreciated , thanks
If you can double-click the PRG file and it opens in FoxPro (meaning the PRG extension has a shell association with the FoxPro executable) then you should be able to use the Run method of VBScript's Shell object to "launch" the PRF file directly:
CreateObject("WScript.Shell").Run Chr(34) & strPathToPrgFile & Chr(34)
Otherwise, you could always launch FoxPro and pass the PRG file as a param:
CreateObject("WScript.Shell").Run Chr(34) & strPathToFoxProExe & Chr(34) & " " & Chr(34) & strPathToPrgFile & Chr(34)

Resources