Content Type
Profiles
Forums
Events
Everything posted by gunsmokingman
-
.vbs MsgBox help
gunsmokingman replied to jamesbebby's topic in Programming (C++, Delphi, VB/VBS, CMD/batch, etc.)
Another way, Chr(34) = " If MsgBox( _ "Run New Process Notifier?",4132,"New Process Notifier") = 6 Then CreateObject("Wscript.Shell").Run(Chr(34) & "C:\Program Files\New Process Notifier\NewProcessNotifier.exe" & Chr(34)),1,False End If -
Find Model Number VBS
gunsmokingman replied to marcusj0015's topic in Programming (C++, Delphi, VB/VBS, CMD/batch, etc.)
You are welcome and glad to help. -
VBS to change comp name
gunsmokingman replied to LeppeRMessiaH's topic in Programming (C++, Delphi, VB/VBS, CMD/batch, etc.)
Another way, this would require that a user is log on. Dim Act :Set Act = CreateObject("Wscript.Shell") Dim UNm :UNm = Act.ExpandEnvironmentStrings("%UserName%") -
.vbs MsgBox help
gunsmokingman replied to jamesbebby's topic in Programming (C++, Delphi, VB/VBS, CMD/batch, etc.)
I thnk the problem is you need a full path to app and it full name This might work This only ways this would work if the app in \Windows Folder Or \Windows\System32 folder Or the VBS file is in the same location as the app. -
.vbs MsgBox help
gunsmokingman replied to jamesbebby's topic in Programming (C++, Delphi, VB/VBS, CMD/batch, etc.)
Or another way of doing it, with code only for yes If MsgBox( _ "Would You Like To Open Notepad?",4132,"Yes No Notepad") = 6 Then CreateObject("Wscript.Shell").Run("Notepad"),1,False End If Msgbox with a timer to close after 5 seconds with code only for yes Dim Act :Set Act = CreateObject("Wscript.Shell") If Act.Popup( _ "Would You Like To Open Notepad?" & vbCrLf & _ "If Nothing Is Selected In Five" & vbCrLf & _ "Seconds This Dialog Will Close", 5,"Yes No Self Close", 4132) = 6 Then Act.Run("Notepad"),1,False End If -
Find Model Number VBS
gunsmokingman replied to marcusj0015's topic in Programming (C++, Delphi, VB/VBS, CMD/batch, etc.)
Scan.vbs Dim L, Obj, Rpt, Str, Wmi L = "----------------------------------------------" '-> Make Sure Correct Engine Cscript Is Active If InStr(1,WScript.FullName,"cscript",1) Then CorrectEng(WScript.FullName) ElseIf InStr(1,WScript.FullName,"wscript",1) Then WrongEng("Wscript.exe") End If '-> Wrong Script Engine Wscript Function WrongEng(Wrong) Dim E :E = " Error : Wrong Scripting Engine" MsgBox Space(3) & Chr(187) & E & vbCrLf & _ "This " & Wrong & " Is Not The Correct Engine" & vbCrLf & _ vbCrLf & "To Run This Script, Right Click And Select" & _ vbCrLf & "The Cmd Prompt As The Script Engine",4128,E End Function '-> Correct Script Engine Wscript Function CorrectEng(Correct) Set Wmi = GetObject("winmgmts:" & _ "{impersonationLevel=impersonate}!\\.\root\cimv2") For Each Obj In Wmi.ExecQuery("SELECT * FROM Win32_ComputerSystem") Rpt = L & vbCrLf & _ "Computer Name : " & Obj.Name & vbCrLf & _ "Computer Make : " & Obj.Model & vbCrLf & _ "Computer Model : " & Obj.Manufacturer & vbCrLf & _ "Scan Date : " & Date & vbCrLf & _ "Scan Time : " & Time & vbCrLf & L TheReport(Obj.Name) Next End Function '-> Save Information Function TheReport(Cmp) Dim Act :Set Act = CreateObject("Wscript.Shell") Dim Fso :Set Fso = CreateObject("Scripting.FileSystemObject") Dim F, Ts F = Act.SpecialFolders("DeskTop") & "\" & Cmp & "_Result.txt" Set Ts = Fso.CreateTextFile(F) Ts.WriteLine Rpt Ts.Close Act.Run("Notepad.exe " & Chr(34) & F & Chr(34)),1,False WScript.Quit End Function Change Scan.vbs.txt to Scan.vbs ro maje active script Scan.vbs.txt -
Find Model Number VBS
gunsmokingman replied to marcusj0015's topic in Programming (C++, Delphi, VB/VBS, CMD/batch, etc.)
I re did the original script, I made it a few lines smaller PingScan_1.vbs Option Explicit Dim L, Obj, Rpt, Str, Wmi L = "----------------------------------------------" '-> Make Sure Correct Engine Cscript Is Active If InStr(1,WScript.FullName,"cscript",1) Then CorrectEng(WScript.FullName) ElseIf InStr(1,WScript.FullName,"wscript",1) Then WrongEng("Wscript.exe") End If '-> Wrong Script Engine Wscript Function WrongEng(Wrong) Dim E :E = " Error : Wrong Scripting Engine" MsgBox Space(3) & Chr(187) & E & vbCrLf & _ "This " & Wrong & " Is Not The Correct Engine" & vbCrLf & _ vbCrLf & "To Run This Script, Right Click And Select" & _ vbCrLf & "The Cmd Prompt As The Script Engine",4128,E End Function '-> Correct Script Engine Wscript Function CorrectEng(Correct) Do While Str = "" WScript.StdOut.WriteLine L WScript.StdOut.WriteLine "Type In The Computer Name Or Ip Address" WScript.StdOut.WriteLine "That You Want To Connect To. Type Either" WScript.StdOut.WriteLine "Exit Or Quit To Do Nothing" WScript.StdOut.WriteLine L & vbCrLf Str = Wscript.StdIn.ReadLine If InStr(1,Str,"Exit",1) Or InStr(1,Str,"quit",1) Then WScript.Quit If Len(Str) >= 1 Then PingComputer(Str) Loop End Function '-> Ping Computer For XP And Up Function PingComputer(Ping) For Each Obj In GetObject("winmgmts:\\.\root\cimv2").ExecQuery _ ("Select * From Win32_PingStatus where Address = '" & Ping & "'") If IsNull(Obj.StatusCode) Or Obj.StatusCode <> 0 Then '-> No Reply Rpt = L & vbCrLf & _ "No Reply : " & Ping & vbCrLf & _ "Date : " & Date & vbCrLf & _ "Time : " & Time & vbCrLf & L TheReport() Else '-> Yes Reply Set Wmi = GetObject( _ "winmgmts:{impersonationLevel=impersonate}!\\" & Ping & "\root\cimv2") MakeModel(Ping) End If Next End Function '-> Computer Name Make Model Function MakeModel(Computer) For Each Obj In Wmi.ExecQuery("SELECT * FROM Win32_ComputerSystem") Rpt = L & vbCrLf & _ "Name : " & Obj.Name & vbCrLf & _ "Make : " & Obj.Model & vbCrLf & _ "Model : " & Obj.Manufacturer & vbCrLf & _ "Date : " & Date & vbCrLf & _ "Time : " & Time & vbCrLf & L TheReport() Next End Function '-> Save Information Function TheReport() WScript.StdOut.WriteLine Rpt & vbCrLf & L Wscript.StdOut.WriteLine _ "Did You Want To Save This To A Text File?" & vbCrLf & _ "Yes To Save The Information No To Close" & vbCrLf & _ "Or Press Enter To Close And Not Save" & vbCrLf & L & vbCrLf Str = Wscript.StdIn.ReadLine If InStr(1,Str,"No",1) Then WScript.Quit If Len(Str) = 0 Then WScript.Quit If InStr(1,Str,"yes",1) Then Dim Act :Set Act = CreateObject("Wscript.Shell") Dim Fso :Set Fso = CreateObject("Scripting.FileSystemObject") Dim F, Ts F = Act.SpecialFolders("DeskTop") & "\Result.txt" Set Ts = Fso.CreateTextFile(F) Ts.WriteLine Rpt Ts.Close Act.Run("Notepad.exe " & Chr(34) & F & Chr(34)),1,False WScript.Quit End If End Function Rename PingScan_1.vbs.txt to PingScan_1.vbs to make active PingScan_1.vbs.txt -
Find Model Number VBS
gunsmokingman replied to marcusj0015's topic in Programming (C++, Delphi, VB/VBS, CMD/batch, etc.)
Here I wrote this script 1:\ Run in Cscript and all output in cmd window. 2:\ Gets User Input For IP Address Or Computer Name 3:\ Ping Computer 4:\ Ask to save the results. Save As PingScan.vbs Just rename the file from PingScan.vbs.txt to PingScan.vbs to make active script. PingScan.vbs.txt -
Best Way To Slipstream Updates?
gunsmokingman replied to oilernut's topic in Unattended Windows 7/Server 2008R2
Here is a Link that list DISM commands. -
Commands run in the background on clicking "Repair"
gunsmokingman replied to kumarkumar's topic in Windows XP
Maybe in this order, this is just a guess and nothing more ipconfig /release ipconfig /flushdns ipconfig /renew -
The first problem you have is 1:\ 2:\This will always return the 32 bit Perhaps something like this would be better I will post a better script later, but the above code should help out. Here is a updated script Could you post the batch file code,because you can most likely have it coded to the script, instead of a separae Batch File.
-
VB Resolve HostName from IP
gunsmokingman replied to pany03's topic in Programming (C++, Delphi, VB/VBS, CMD/batch, etc.)
I do not know if this will help you, but here is a app made from VB.Net 2008 You can then list idividual results from the first querry You can save the results. Here is the code Imports System Imports System.IO Imports System.Net Public Class Form1 ''' <summary> ''' Coded By Gunsmokingman Aka Jake1Eye Aka Ed ''' </summary> Dim Ln = "------------------------------------------------------------------------------" '-> Ping Then Enumarate Ip Address Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Select Case Button1.Text Case "Submit" Try If My.Computer.Network.Ping(IpTxt.Text) Then EnumarateIp(IpTxt.Text) Button1.Text = "Clear" Else MsgBox("Could Not Ping This Addres : " & IpTxt.Text) End If Catch ex As Exception MsgBox("Error : There Was No Valid Ip Address" & vbCrLf & _ "Or There Is No Valid Internet Address", MsgBoxStyle.Exclamation) IpTxt.Text = "" End Try Case "Clear" Button1.Text = "Submit" IpTxt.Text = "" ListBox1.Items.Clear() End Select End Sub '-> Return Ip Addresses Private Sub EnumarateIp(ByVal IpTest) Dim hostInfo As IPHostEntry = Dns.GetHostEntry(IpTest) ListBox1.Items.Add("Host Name : " & hostInfo.HostName) ListBox1.Items.Add(Ln) For i = 0 To hostInfo.AddressList.Length - 1 ListBox1.Items.Add("Address List : " & hostInfo.AddressList(i).ToString) Next ListBox1.Items.Add(Ln) End Sub '-> Save The Information Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click If ListBox1.Items.Count = 0 Then MsgBox("Error There Was No Information To Save") Else Dim Nw = "_" & Microsoft.VisualBasic.Replace(Date.Today, "/", "") & "_" Dim Tm = Microsoft.VisualBasic.Replace(TimeOfDay, ":", "") Dim Tn = Microsoft.VisualBasic.Replace(Tm, " ", "") Dim Cm = My.Computer.Name & Nw & Tn & "_ResolveHostName.txt" Dim Dt = My.Computer.FileSystem.SpecialDirectories.Desktop.ToString & "\" & Cm Dim sw As StreamWriter = New StreamWriter(Dt.ToString) For i = 0 To ListBox1.Items.Count - 1 sw.WriteLine(ListBox1.Items.Item(i)) Next sw.Close() Process.Start(Chr(34) & Dt.ToString & Chr(34)) End If End Sub '-> Selection From Listbox1 To Get Individual Results Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged ListBox1.Items.Add(vbCrLf) For i = 0 To ListBox1.Items.Count - 1 If InStr(ListBox1.SelectedItem, "Address") Then If ListBox1.SelectedItem = ListBox1.Items.Item(i) Then Dim A1 = Split(ListBox1.SelectedItem, " : ") IpTxt.Text = A1(1) EnumarateIp(A1(1)) End If End If Next End Sub End Class Source Code -
VB Resolve HostName from IP
gunsmokingman replied to pany03's topic in Programming (C++, Delphi, VB/VBS, CMD/batch, etc.)
Thank you for posting your solution -
Here a little demo script for you 1:\ open Notepad waits for it to close 2:\ When Notepad is closed a messagebox appears to ask if you want to open Mspaint Save As DemoRunApp.vbs '-> Object Dim Act :Set Act = CreateObject("Wscript.Shell") '-> Open The First Item Act.Run("Notepad"), 1, True '-> Yes No Messagebox If MsgBox( _ "Notepad has been closed. Would you like" & vbCrLf & _ "To open Mspaint next?",4132,"Demo Yes No") = 6 Then '->Yes Was Pressed Act.Run("Mspaint"),1,True Else '->No Was Pressed Act.Popup "User cancel opening MsPaint, This dialog" & vbCrLf & _ "will self close it self in 5 seconds.",5,"End Script",4128 End If
-
opening url from vbscript
gunsmokingman replied to sanjeev18's topic in Programming (C++, Delphi, VB/VBS, CMD/batch, etc.)
Or as a single line of vbs script CreateObject("WScript.Shell").Run("http://www.google.com") -
I made a simple VB.Net app for makecab, all you have to do use it is drag and drop the file onto the app. This app will also Expand files that have been compressed with Makecab. The Thread MakeCab And Expand App
-
Perhaps try this in your bat @Echo Off CLS Mode 62, 9 Color F9 Set Char=C: D: E: F: G: H: I: J: K: L: M: N: O: P: Q: R: S: T: U: V: W: X: Y: Z: for %%i in (%Char%) do if exist %%i\SETUP.exe Goto Confirm for %%i in (%Char%) do if not exist %%i\SETUP.exe Goto Missing :Confirm set CDROM=%%i set AnswerFile=.\unattend.txt set SetupFiles=%CDROM%:\amd64 %CDROM%:\amd64\winnt32 /s:%SetupFiles% /unattend:%AnswerFile% /copysource:lang Goto TheEnd :Missing set CDROM=Error Unknown Occur CLS Echo. echo %CDROM% pause Goto TheEnd :TheEnd Exit
-
vbs ping
gunsmokingman replied to baxta24's topic in Programming (C++, Delphi, VB/VBS, CMD/batch, etc.)
Here try this script, I havnt coded in the exe stuff yet. Save As WmiPing3.vbs