WMI

Oct 18, 2008
268
1
#1
Hello --

Sorry, if this is a repeat question, is it possible to
run WMI function in a BTM file?

I have a vb script file

Set IRP =getobject("winmgmts:\\.\root\default:Systemrestore")
MYRP = IRP.createrestorepoint ("My Restore Point", 0, 100)

that creates a restore point -- can this be converted to a btm/cmd file

thanks
 
#3
can this be converted to a btm/cmd file
The @WMI can only be used to return the results of the WMI query.

There is the SRSetRestorePoint API, that could be used from within a plugin, or possibly be called from the @WINAPI variable function.

Since you already have the VBS script, you could use the SCRIPT command to run your VBS script from within a BTM file.

Joe
 
#4
can this be converted to a btm/cmd file
I created a .BTM to call the necessary code from a .VBS to create a restore point, and it worked with no problems on my XP system. Here's the code for the .BTM;

Code:
@echo off
@setlocal
echo Starting restpoint.vbs
script restpoint.vbs
echo Finished running restpoint.vbs
endlocal
Here's the code for the .VBS;

Code:
Set IRP = getobject("winmgmts:\\.\root\default:Systemrestore")
MYRP = IRP.createrestorepoint ("My Restore Point", 0, 100)
There is no doubt a way to query the System Restore points using @WMI, to verify the creation of a restore point, so I will look into how to accomplish this later today.

Joe
 
#5
There is no doubt a way to query the System Restore points using @WMI, to verify the creation of a restore point, so I will look into how to accomplish this later today.
Here is how to query for the restore point using @WMI;

Code:
echo %@wmi[root\default,"select * from SystemRestore Where Description = 'My Restore Point'"]
On my XP system, this returned;

Code:
20111129143735.307375-000
My Restore Point
100
0
409
According to the WMICodeCreator.exe, these returned items correspond to;

CreationTime
Description
EventType
RestorePointType
SequenceNumber

Joe