Thread: VBS scripts
-
May 28th, 2003, 11:15 PM #1
VBS scripts
Anyone know some cool vbs scripts that you can write in notepad???
Heres one of my favorites.
for i = 1 to 10
msgbox"you get to click this"& i-10 &"more times"
next
Just write this in notepad and save as whatever.vbs
Post YoursGi | Yuu | Jin | Rei | Makoto | Meiyo | Chuugi
-
May 28th, 2003, 11:41 PM #2Not Really a Member
- Join Date
- Oct 2001
- Posts
- 27,856
Exports all users home drives and usernames from a NT4 domain into a text fileCode:Dim sUserInfo Dim objUser Dim sHomeDir Dim objDomainUsers Dim objFSO Dim objUserListFile Dim strExportFile Dim objShell Set objShell = CreateObject("WScript.Shell") sWorkingDir = objShell.CurrentDirectory strExportFile = sWorkingDir & "\AllUsers.txt" Set objDomainUsers = GetObject("WinNT://" + "<Insert Domain Name Here>") Set objFSO = CreateObject("Scripting.FileSystemObject") Set objFile = objFSO.CreateTextFile(strExportFile) For Each objUser In objDomainUsers If (objUser.Class = "User") Then ''Set oUser = oIADs If objUser.HomeDirectory <> "" Then sHomeDir = objUser.HomeDirectory If sHomeDir <> "" Then sUserInfo = sHomeDir & vbTab & objUser.Name objFile.WriteLine sUserInfo End IF End If End If Next WScript.Echo "All Users exported into " & strExportFile
Helicopters don't fly; they vibrate so much and make so much noise that the earth rejects them.
-
July 16th, 2003, 05:22 PM #3
Free VBScript
Let me know if you use it......
Dim strStatus
Dim pstatus
Dim IE
Dim Connect
Dim objWMIService, objSystem
Dim ColSystem, sManufacturer, sSystemtype, sSystemName, sBiosRev
Dim sServiceTag, sAssetTag, subnet, scpucount
Set objCDO = wscript.CreateObject("CDO.Message")
Set objExplorer = WScript.CreateObject("InternetExplorer.Application ", "IE_")
objExplorer.Navigate "Enter your site Here"
objExplorer.Visible = 1
objExplorer.ToolBar = 0
objExplorer.StatusBar = 0
objExplorer.Width=600
objExplorer.Height = 600
objExplorer.Left = 0
objExplorer.Top = 0
While objExplorer.Busy: Wend
subnet = inputbox("enter system To scan:")
If subnet = "" Then
subnet = "."
End If
Call getinfo(subnet)
Call updatestatus("Complete")
Function Updatestatus(comments)
objExplorer.Document.Body.All.wstatus.Value = comments
End Function
Function WMIDateStringToDate(utcDate)
WMIDateStringToDate = CDate(Mid(utcDate, 5, 2) & "/" & Mid(utcDate, 7, 2) & "/" & Left(utcDate, 4) & " " & Mid (utcDate, 9, 2) & ":" & Mid(utcDate, 11, 2) & ":" & Mid(utcDate, 13, 2))
End Function
'================================================= ================================================== =
Function GetInfo(IPAddress)
While objExplorer.busy: Wend
Call updatestatus("Starting Search....")
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonat e,AuthenticationLevel=pktprivacy}\\" & IPAddress & "\root\cimv2")
If Err.Number = 0 Then
Set ColSystem=objWMIService.execquery ("Select * from Win32_ComputerSystem")
Call updatestatus("Searching hardware")
For each objSystem in colSystem
sManufacturer = objSystem.Manufacturer
sSystemtype = objSystem.Model
sSystemName = objSystem.Name
Next
objExplorer.Document.Body.All.wSystemType.Value = ssystemtype
objExplorer.Document.Body.All.wSystemName.Value = ssystemname
objExplorer.Document.Body.All.wManufacturer.Value = smanufacturer
Set ColSystem=objWMIService.execquery ("Select * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True")
Call updatestatus("Searching Network Card")
For Each objAdapter In ColSystem
If Not IsNull(objAdapter.IPAddress) Then
sIPAddress = objAdapter.IPAddress(0)
objExplorer.Document.Body.All.wIPAddress.Value = sIPAddress
End If
objExplorer.Document.Body.All.wsubnet.Value = objAdapter.IPSubnet(0)
objExplorer.Document.Body.All.wnic.Value = objAdapter.Description
objExplorer.Document.Body.All.wmacaddress.Value = objAdapter.MACAddress
objExplorer.Document.Body.All.wgateway.Value = objAdapter.DefaultIPGateway(0)
For i = 0 To UBound(objAdapter.DNSServerSearchOrder)
objExplorer.Document.Body.All.wdnsserver.Value = objExplorer.Document.Body.All.wdnsserver.Value & objAdapter.DNSServerSearchOrder(i) & vbCrlf
Next
objExplorer.Document.Body.All.wdnsdomain.Value = objAdapter.DNSDomain
objExplorer.Document.Body.All.wdhcpserver.Value = objAdapter.DHCPServer
If objAdapter.DHCPEnabled Then
objExplorer.Document.Body.All.wleaseobtained.Value = WMIDateStringToDate(objAdapter.DHCPLeaseObtained)
objExplorer.Document.Body.All.wleaseexpires.Value = WMIDateStringToDate(objAdapter.DHCPLeaseExpires)
End If
objExplorer.Document.Body.All.wwins.Value = objAdapter.WINSPrimaryServer & vbCrlf & objAdapter.WINSSecondaryServer
objExplorer.Document.Body.All.wdhcp.checked = objAdapter.DHCPEnabled
Next
Set ColSystem=objWMIService.execquery ("Select * from Win32_Printer")
Call updatestatus("Searching Printers...")
For Each objPrinter In ColSystem
objExplorer.Document.Body.All.wprinters.value = objExplorer.Document.Body.All.wprinters.value & objPrinter.Name & vbCrlf
Next
Set colSystem=objWMIService.ExecQuery ("Select * from Win32_Product")
Call updatestatus("Searching for installed software")
For Each objSystem In colSystem
objExplorer.Document.Body.All.wsoftware.value = objExplorer.Document.Body.All.wsoftware.value & vbCrlf & objsystem.Name
Next
Set colSystem=objWMIService.ExecQuery ("Select * from Win32_BIOS")
Call updatestatus("Searching BIOS")
For Each objSystem In colSystem
sBiosRev = objSystem.SMBIOSBIOSVersion
Next
objExplorer.Document.Body.All.wBiosRev.Value = sBiosrev
Set colSystem=objWMIService.ExecQuery ("Select * from Win32_processor")
Call updatestatus("Searching CPU SPeed")
For Each objSystem In colSystem
scpucount = scpucount + 1
sclockspeed = objSystem.currentclockspeed
Next
objExplorer.Document.Body.All.wclockspeed.Value = sclockspeed
objExplorer.Document.Body.All.Wcpucount.value = scpucount
Set colSystem=objWMIService.ExecQuery ("Select * from Win32_operatingsystem")
Call updatestatus("Determining Operating System")
For Each objSystem In colSystem
scaption = objSystem.caption
Next
objExplorer.Document.Body.All.wcaption.Value = scaption
Set colSystem=objWMIService.ExecQuery ("Select * from Win32_physicalmemory")
Call updatestatus("Determining Memory Installed")
For Each objSystem In colSystem
scapacity = scapacity + cint((objSystem.capacity/1048576))
Next
objExplorer.Document.Body.All.wcapacity.Value = scapacity
Set colSystem=objWMIService.ExecQuery ("Select * from Win32_SystemEnclosure")
Call updatestatus("Determining Serial & Asset Tag #")
For Each objSystem In colSystem
sServiceTag = objSystem.serialNumber
sAssetTag = objSystem.SmBiosAssetTag
Next
objExplorer.Document.Body.All.wServiceTag.Value = sservicetag
Else
' If errors, then return string stating could not connect to system with error description
objExplorer.Document.Body.All.werror.Value = Err.description
Err.clear
End If
End Function
-
July 16th, 2003, 11:27 PM #4Not Really a Member
- Join Date
- Oct 2001
- Posts
- 27,856
no worky dude.
Could be an interesting script, so I was trying to make it work but it doesn't like the line
objExplorer.Document.Body.All.wSystemType.Value = ssystemtype
Object isn't supported.
I cleaned up all the word wrapping problems from the html but still no work.
What kind of site is it expecting for the URL? I put in about:blank as I didn't entirely see the point of putting in a real URL seeing that this appears to write to the explorer page.
I may just modify it to output to a text file if I get a few minutes
oh and to keep hte indenting to the code isn't so ugly, I'd suggest using the [ code ] tags
more importantly, Welcome to TechIMO!
Can always use more scripters around
Helicopters don't fly; they vibrate so much and make so much noise that the earth rejects them.
-
February 5th, 2009, 05:07 AM #5Junior Member
- Join Date
- Feb 2009
- Posts
- 2
I know some cool ones!
Heres a few
This will shut down the computer corresponding with its ip address
strComputer = inputbox("Please enter the PC name to reboot.","PC")
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate,(Shutdown)}!\ \" & strComputer & "\root\cimv2")
Set colOperatingSystems = objWMIService.ExecQuery _
("Select * from Win32_OperatingSystem")
For Each objOperatingSystem in colOperatingSystems
ObjOperatingSystem.Reboot()
Next
msgbox "Rebooted, cross your fingers!"
Another is this one. It wont go away unless you go to TaskManager>Processes and find wscript.exe and end it:
msgbox "I!"
msgbox "Got!"
msgbox "You!"
msgbox "Good!"
msgbox "Sucker!"
do
msgbox "Have Fun!"
loop
I know others, but have fun for now!Last edited by DaLemon; February 5th, 2009 at 05:11 AM.
-
February 5th, 2009, 05:11 AM #6Junior Member
- Join Date
- Feb 2009
- Posts
- 2
I tried ur script and it dont work
-
December 6th, 2011, 12:29 PM #7Junior Member
- Join Date
- Dec 2011
- Posts
- 1
text to audio converter
Dim msg, sapi
msg=InputBox("please enter your text to be converted","owen hayman's text to audio converter")
Set sapi=CreateObject("sapi.spvoice")
sapi.Speak msg
-
March 6th, 2012, 06:18 AM #8Junior Member
- Join Date
- Mar 2012
- Posts
- 2
Set colSystem=objWMIService.ExecQuery ("Select * from Win32_physicalmemory")
Call updatestatus("Determining Memory Installed")
For Each objSystem In colSystem
scapacity = scapacity + cint((objSystem.capacity/1048576))
Next
objExplorer.Document.Body.All.wcapacity.Value = scapacity
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)



LinkBack URL
About LinkBacks






Reply With Quote

The fan vote went to miss popularity Danica Patrick instead of a driver with a real chance at winning.
Is It Just Me? v233893843