I have a script that use WMI to stop and delete service which works fine and
then it should delete all files that contains %vnc% in the filename and for
which the extension is EXE.
It is working fine if the remote computer is a WinXP but if remote is Win2K,
it does not work.
What is wrong??
Here is my function delete.
Function del_VNC_exe(strPC)
Dim objWMIService, colFiles, objFile
Set objWMIService = GetObject("winmgmts:\\" & strPC & "\root\cimv2")
Set colFiles = objWMIService.ExecQuery ("Select * From CIM_DataFile Where
Drive='C:' AND FileName LIKE '%vnc%' And Extension = 'exe'")
WScript.Echo colFiles.Count & " files were found." 'for testing
For Each objFile In colFiles
Wscript.Echo objFile.Name 'for testing
'objFile.delete
Next
End Function
Cette action est irreversible, confirmez la suppression du commentaire ?
Signaler le commentaire
Veuillez sélectionner un problème
Nudité
Violence
Harcèlement
Fraude
Vente illégale
Discours haineux
Terrorisme
Autre
Gilles LAURENT [MVP]
"Eric" wrote:
Hi,
I have a script that use WMI to stop and delete service which works fine and then it should delete all files that contains %vnc% in the filename and for which the extension is EXE.
It is working fine if the remote computer is a WinXP but if remote is Win2K, it does not work.
What is wrong??
[...]
It's because the LIKE operator is not available on Windows 2000 :-( It's an addition to WQL since Windows XP/2003 <http://www.microsoft.com/technet/scriptcenter/topics/win2003/like.mspx>
-- Gilles LAURENT MVP Windows Server - Admin Frameworks http://glsft.free.fr
"Eric" wrote:
Hi,
I have a script that use WMI to stop and delete service which works fine and
then it should delete all files that contains %vnc% in the filename and for
which the extension is EXE.
It is working fine if the remote computer is a WinXP but if remote is Win2K,
it does not work.
What is wrong??
[...]
It's because the LIKE operator is not available on Windows 2000 :-(
It's an addition to WQL since Windows XP/2003
<http://www.microsoft.com/technet/scriptcenter/topics/win2003/like.mspx>
--
Gilles LAURENT
MVP Windows Server - Admin Frameworks
http://glsft.free.fr
I have a script that use WMI to stop and delete service which works fine and then it should delete all files that contains %vnc% in the filename and for which the extension is EXE.
It is working fine if the remote computer is a WinXP but if remote is Win2K, it does not work.
What is wrong??
[...]
It's because the LIKE operator is not available on Windows 2000 :-( It's an addition to WQL since Windows XP/2003 <http://www.microsoft.com/technet/scriptcenter/topics/win2003/like.mspx>
-- Gilles LAURENT MVP Windows Server - Admin Frameworks http://glsft.free.fr