|
|
|
|
||||||
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
Hi,
I am trying to make my script do what the subject says: Output PC Name, Serial #, IP, and , OS to CSV using vbs. The script pings a range of ip addresses and then spits back the SN and OS version. I would really perfer to not have to write down all the information it gives me. A CSV file would be ideal Here is my code thus far: (No, I did not write is all by myself) -------------------------- On Error Resume Next intStartingAddress = 1 intEndingAddress = 255 strSubnet = "192.168.90." Const WbemAuthenticationLevelPktPrivacy = 6 strCredentials = InputBox _ ("Please enter the user name, a blank space, and then the password:", _ "Enter User Credentials") If strCredentials = "" Then Wscript.Quit End If arrCredentials = Split(strCredentials," ") strUser = arrCredentials(0) strPassword = arrCredentials(1) strNamespace = "root\cimv2" For i = intStartingAddress to intEndingAddress strComputer = strSubnet & i Set objShell = CreateObject("WScript.Shell") strCommand = "%comspec% /c ping -n 2 -w 300 " & strComputer & "" Set objExecObject = objShell.Exec(strCommand) Do While Not objExecObject.StdOut.AtEndOfStream strText = objExecObject.StdOut.ReadAll() If Instr(strText, "Reply") > 0 Then Set objWbemLocator = CreateObject("WbemScripting.SWbemLocator") Set objWMIService = objwbemLocator.ConnectServer _ (strComputer, strNamespace, strUser, strPassword) objWMIService.Security_.authenticationLevel = WbemAuthenticationLevelPktPrivacy ' ================================================== =================== winmgmt1 = "winmgmts:{impersonationLevel=impersonate}!//"& strComputer &"" Set SerialN = GetObject( winmgmt1 ).InstancesOf ("Win32_BIOS") For each Serial in SerialN WScript.Echo "Serial Number: " & Serial.SerialNumber Next ' Constants for FileSystemObject Const FOR_READING = 1 Const FOR_WRITING = 2 Const FOR_APPENDING = 8 strFileOutput = "c:\scripts\PCInfo.csv" ' Create a Script Runtime FileSystemObject. Set objFSO = CreateObject(" Scripting.FileSystemObject") ' Check to see if the output file exists. If so, open it for writing or appending. ' If not, create it and open it for writing. If objFSO.FileExists(strFileOutput) Then Set objOutputFile = objFSO.OpenTextFile (strFileOutput, FOR_WRITING) Else Set objOutputFile = objFSO.CreateTextFile(strFileOutput) End If If Err <> 0 Then Wscript.Echo "Unable to open " & strFileOutput & " for output." WScript.Quit End If ' Write header for file. CUrrent date and header, and LINE space objOutputFile.WriteLine "Date and Time" & _ VbCrLf & "Taken " & Now & VbCrLf & VbCrLf & String(120, "-") & VbCrLf 'Create Headers for Host, NIC, IP and SubNet Mask objOutputFile.Writeline "Host Name, Network Card, IP Address, Subnet Mask" arrComputers = Array ( strcomputer ) For Each strComputer In arrComputers ' Ping remote computer. If inaccessible, display error message. Set objShell = CreateObject("WScript.Shell") Set objScriptExec = objShell.Exec("ping -n 2 -w 1000 " & strComputer) strPingResults = LCase(objScriptExec.StdOut.ReadAll) If InStr(strPingResults, "reply from") Then objOutputFile.WriteLine VbCrLf & "Host Name:," & VbCrLf & " " & strComputer Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") ' Test for success in binding to WMI. If Err = 0 Then Set colNicConfigs = objWMIService.ExecQuery("SELECT * FROM " & _ "Win32_NetworkAdapterConfiguration WHERE IPEnabled = True") 'Echo to screen, or write to file For Each objNicConfig In colNicConfigs objOutputFile.WriteLine VbCrLf & "Network Adapter " & objNicConfig.Index objOutputFile.WriteLine " " & objNicConfig.Description & VbCrlF objOutputFile.WriteLine "IP Address(es):" For Each strIPAddress In objNicConfig.IPAddress objOutputFile.WriteLine " " & strIPAddress Next objOutputFile.WriteLine "Subnet Mask(s):" For Each strIPSubnet In objNicConfig.IPSubnet objOutputFile.WriteLine " " & strIPSubnet Next Next Else objOutputFile.WriteLine VbCrLf & "Error: Unable to connect to WMI." & VbCrLf & _ "Error Number: " & Err.Number & VbCrLf & _ "Error Source: " & Err.Source & VbCrLf & _ "Error Description: " & Err.Description Err.Clear End If Else objOutputFile.WriteLine VbCrLf & "Host Name: " & strComputer & VbCrLf & _ " Unable to connect." End If Next ' ================================================== =================== Set colItems = objWMIService.ExecQuery _ ("Select * From Win32_OperatingSystem") For Each objItem in ColItems Wscript.Echo strComputer & ": " & objItem.Caption Next ' ================================================== =================== ' End ' ================================================== =================== Else Wscript.Echo strComputer & " could be not reached." End If Loop Next --------------------------------------------------------------- I Don't care for the network card info. All I want to be put in the CSV is the PC Name, Serial Number, IP, OS, and if it pings but can't connect to the WMI then have it put the IP in the IP column and have it say "Not a computer" Or something along those lines, in another column. I need this for a really big project and this script will save me DAYS worth of work as compared to a couple of hours. Thank you all in advance just for reading all the way down to this bottom line!!!!!! ![]() ![]() ![]() |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
For previous tasks like this I usually just build out the file contents
using a CSV format, create the text file with a .csv file extension, then write the contents to the file. Sample: Const ForWriting = 2 Dim strFileHeader, strFileContents, strSomeLineDataCSVFormatted Dim strFilePath strFilePath = "c:\testfile.csv" strFileHeader = "MachineName,OS,SerialNumber" strFileContents = strFileHeader & vbCrLf strFileContents = strFileContents & strSomeDataCSVFormatted & vbCrLf Set objFSO = CreateObject("Scripting.FileSystemObject") Set objFileCreate = objFSO.CreateTextFile(strFilePath) objFileCreate.Close Set objFileWrite = objFSO.OpenTextFile(strFilePath, ForWriting) objFileWrite.Write strFileContents objFileWrite.Close "Hickory" <Hickory@discussions.microsoft.com> wrote in message news:BF721B4D-D5AD-45D3-81EF-8B0F19DF2344@microsoft.com... > Hi, > I am trying to make my script do what the subject says: Output PC Name, > Serial #, IP, and , OS to CSV using vbs. > > The script pings a range of ip addresses and then spits back the SN and OS > version. I would really perfer to not have to write down all the > information > it gives me. A CSV file would be ideal > > Here is my code thus far: > (No, I did not write is all by myself) > -------------------------- > > On Error Resume Next > > intStartingAddress = 1 > intEndingAddress = 255 > strSubnet = "192.168.90." > > Const WbemAuthenticationLevelPktPrivacy = 6 > > strCredentials = InputBox _ > ("Please enter the user name, a blank space, and then the password:", _ > "Enter User Credentials") > > If strCredentials = "" Then > Wscript.Quit > End If > > arrCredentials = Split(strCredentials," ") > strUser = arrCredentials(0) > strPassword = arrCredentials(1) > strNamespace = "root\cimv2" > > For i = intStartingAddress to intEndingAddress > strComputer = strSubnet & i > > Set objShell = CreateObject("WScript.Shell") > strCommand = "%comspec% /c ping -n 2 -w 300 " & strComputer & "" > Set objExecObject = objShell.Exec(strCommand) > > Do While Not objExecObject.StdOut.AtEndOfStream > strText = objExecObject.StdOut.ReadAll() > If Instr(strText, "Reply") > 0 Then > > Set objWbemLocator = CreateObject("WbemScripting.SWbemLocator") > Set objWMIService = objwbemLocator.ConnectServer _ > (strComputer, strNamespace, strUser, strPassword) > objWMIService.Security_.authenticationLevel = > WbemAuthenticationLevelPktPrivacy > > > ' > ================================================== =================== > winmgmt1 = "winmgmts:{impersonationLevel=impersonate}!//"& strComputer &"" > Set SerialN = GetObject( winmgmt1 ).InstancesOf ("Win32_BIOS") > > For each Serial in SerialN > WScript.Echo "Serial Number: " & Serial.SerialNumber > Next > > ' Constants for FileSystemObject > Const FOR_READING = 1 > Const FOR_WRITING = 2 > Const FOR_APPENDING = 8 > > strFileOutput = "c:\scripts\PCInfo.csv" > > ' Create a Script Runtime FileSystemObject. > Set objFSO = CreateObject(" Scripting.FileSystemObject") > > ' Check to see if the output file exists. If so, open it for writing or > appending. > ' If not, create it and open it for writing. > > If objFSO.FileExists(strFileOutput) Then > Set objOutputFile = objFSO.OpenTextFile (strFileOutput, FOR_WRITING) > Else > Set objOutputFile = objFSO.CreateTextFile(strFileOutput) > End If > If Err <> 0 Then > Wscript.Echo "Unable to open " & strFileOutput & " for output." > WScript.Quit > End If > > ' Write header for file. CUrrent date and header, and LINE space > objOutputFile.WriteLine "Date and Time" & _ > VbCrLf & "Taken " & Now & VbCrLf & VbCrLf & String(120, "-") & VbCrLf > > 'Create Headers for Host, NIC, IP and SubNet Mask > objOutputFile.Writeline "Host Name, Network Card, IP Address, Subnet Mask" > > > arrComputers = Array ( strcomputer ) > > For Each strComputer In arrComputers > > ' Ping remote computer. If inaccessible, display error message. > Set objShell = CreateObject("WScript.Shell") > Set objScriptExec = objShell.Exec("ping -n 2 -w 1000 " & strComputer) > strPingResults = LCase(objScriptExec.StdOut.ReadAll) > If InStr(strPingResults, "reply from") Then > > objOutputFile.WriteLine VbCrLf & "Host Name:," & VbCrLf & " " & > strComputer > > Set objWMIService = GetObject("winmgmts:" _ > & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") > ' Test for success in binding to WMI. > If Err = 0 Then > Set colNicConfigs = objWMIService.ExecQuery("SELECT * FROM " & _ > "Win32_NetworkAdapterConfiguration WHERE IPEnabled = True") > 'Echo to screen, or write to file > For Each objNicConfig In colNicConfigs > objOutputFile.WriteLine VbCrLf & "Network Adapter " & > objNicConfig.Index > objOutputFile.WriteLine " " & objNicConfig.Description & VbCrlF > objOutputFile.WriteLine "IP Address(es):" > For Each strIPAddress In objNicConfig.IPAddress > objOutputFile.WriteLine " " & strIPAddress > Next > objOutputFile.WriteLine "Subnet Mask(s):" > For Each strIPSubnet In objNicConfig.IPSubnet > objOutputFile.WriteLine " " & strIPSubnet > Next > Next > Else > objOutputFile.WriteLine VbCrLf & "Error: Unable to connect to WMI." & > VbCrLf & _ > "Error Number: " & Err.Number & VbCrLf & _ > "Error Source: " & Err.Source & VbCrLf & _ > "Error Description: " & Err.Description > Err.Clear > End If > > Else > > objOutputFile.WriteLine VbCrLf & "Host Name: " & strComputer & VbCrLf & > _ > " Unable to connect." > > End If > > Next > > ' > ================================================== =================== > > Set colItems = objWMIService.ExecQuery _ > ("Select * From Win32_OperatingSystem") > For Each objItem in ColItems > Wscript.Echo strComputer & ": " & objItem.Caption > Next > > ' > ================================================== =================== > ' End > ' > ================================================== =================== > > Else > Wscript.Echo strComputer & " could be not reached." > End If > Loop > Next > > > --------------------------------------------------------------- > I Don't care for the network card info. All I want to be put in the CSV is > the PC Name, Serial Number, IP, OS, and if it pings but can't connect to > the > WMI then have it put the IP in the IP column and have it say "Not a > computer" > Or something along those lines, in another column. > > I need this for a really big project and this script will save me DAYS > worth > of work as compared to a couple of hours. > > Thank you all in advance just for reading all the way down to this bottom > line!!!!!! ![]() ![]() ![]() |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
Thank you so much for that, Dveit. It now sucessfully writes a csv file
![]() But I can't get is to write the data that I need into the file. Not only that, Every time it can't ping a computer, a dialog box pops up, when it finds a serial # a box pops up, when it finds the OS version, a box pops up and I have to click ok every time that happens. Is there a way to have a simple "Please wait..." and not have anything pop up and have it write all information to the file? I am very new at writing vbs and I know next to nothing about its commands that correspond with WMI. I am very good at writing dos batch files, but I can't get the results I want with that method. My current code is as follows: again, thank you very much for the response ---------------------------------------------- On Error Resume Next intStartingAddress = 1 intEndingAddress = 255 strSubnet = "192.168.90." Const WbemAuthenticationLevelPktPrivacy = 6 strCredentials = InputBox _ ("Please enter the user name, a blank space, and then the password:", _ "Enter User Credentials") If strCredentials = "" Then Wscript.Quit End If arrCredentials = Split(strCredentials," ") strUser = arrCredentials(0) strPassword = arrCredentials(1) strNamespace = "root\cimv2" For i = intStartingAddress to intEndingAddress strComputer = strSubnet & i Set objShell = CreateObject("WScript.Shell") strCommand = "%comspec% /c ping -n 2 -w 300 " & strComputer & "" Set objExecObject = objShell.Exec(strCommand) Do While Not objExecObject.StdOut.AtEndOfStream strText = objExecObject.StdOut.ReadAll() If Instr(strText, "Reply") > 0 Then Set objWbemLocator = CreateObject("WbemScripting.SWbemLocator") Set objWMIService = objwbemLocator.ConnectServer _ (strComputer, strNamespace, strUser, strPassword) objWMIService.Security_.authenticationLevel = WbemAuthenticationLevelPktPrivacy ' ================================================== =================== winmgmt1 = "winmgmts:{impersonationLevel=impersonate}!//"& strComputer &"" Set SerialN = GetObject( winmgmt1 ).InstancesOf ("Win32_BIOS") For each Serial in SerialN WScript.Echo "Serial Number: " & Serial.SerialNumber Next Const ForWriting = 2 Dim strFileHeader, strFileContents, strSomeLineDataCSVFormatted Dim strFilePath strFilePath = "c:\scripts\testfile.csv" strFileHeader = "MachineName,OS,SerialNumber" strFileContents = strFileHeader & vbCrLf strFileContents = strFileContents & strSomeDataCSVFormatted & vbCrLf Set objFSO = CreateObject("Scripting.FileSystemObject") Set objFileCreate = objFSO.CreateTextFile(strFilePath) objFileCreate.Close Set objFileWrite = objFSO.OpenTextFile(strFilePath, ForWriting) objFileWrite.Write strFileContents objFileWrite.Close ' ================================================== =================== Set colItems = objWMIService.ExecQuery _ ("Select * From Win32_OperatingSystem") For Each objItem in ColItems Wscript.Echo strComputer & ": " & objItem.Caption Next ' ================================================== =================== ' End ' ================================================== =================== Else Wscript.Echo strComputer & " could be not reached." End If Loop Next ----------------------------------------------- "dveit" wrote: > For previous tasks like this I usually just build out the file contents > using a CSV format, create the text file with a .csv file extension, then > write the contents to the file. Sample: > > Const ForWriting = 2 > > Dim strFileHeader, strFileContents, strSomeLineDataCSVFormatted > Dim strFilePath > > strFilePath = "c:\testfile.csv" > strFileHeader = "MachineName,OS,SerialNumber" > strFileContents = strFileHeader & vbCrLf > strFileContents = strFileContents & strSomeDataCSVFormatted & vbCrLf > Set objFSO = CreateObject("Scripting.FileSystemObject") > Set objFileCreate = objFSO.CreateTextFile(strFilePath) > objFileCreate.Close > Set objFileWrite = objFSO.OpenTextFile(strFilePath, ForWriting) > objFileWrite.Write strFileContents > objFileWrite.Close |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
On Oct 9, 9:09 pm, Hickory <Hick...@discussions.microsoft.com> wrote:
> Thank you so much for that, Dveit. It now sucessfully writes a csv file ![]() > But I can't get is to write the data that I need into the file. Not only > that, Every time it can't ping a computer, a dialog box pops up, when it > finds a serial # a box pops up, when it finds the OS version, a box pops up > and I have to click ok every time that happens. Is there a way to have a > simple "Please wait..." and not have anything pop up and have it write all > information to the file? > > I am very new at writing vbs and I know next to nothing about its commands > that correspond with WMI. I am very good at writing dos batch files, but I > can't get the results I want with that method. > > My current code is as follows: > again, thank you very much for the response > ---------------------------------------------- > > On Error Resume Next > > intStartingAddress = 1 > intEndingAddress = 255 > strSubnet = "192.168.90." > > Const WbemAuthenticationLevelPktPrivacy = 6 > > strCredentials = InputBox _ > ("Please enter the user name, a blank space, and then the password:", _ > "Enter User Credentials") > > If strCredentials = "" Then > Wscript.Quit > End If > > arrCredentials = Split(strCredentials," ") > strUser = arrCredentials(0) > strPassword = arrCredentials(1) > strNamespace = "root\cimv2" > > For i = intStartingAddress to intEndingAddress > strComputer = strSubnet & i > > Set objShell = CreateObject("WScript.Shell") > strCommand = "%comspec% /c ping -n 2 -w 300 " & strComputer & "" > Set objExecObject = objShell.Exec(strCommand) > > Do While Not objExecObject.StdOut.AtEndOfStream > strText = objExecObject.StdOut.ReadAll() > If Instr(strText, "Reply") > 0 Then > > Set objWbemLocator = CreateObject("WbemScripting.SWbemLocator") > Set objWMIService = objwbemLocator.ConnectServer _ > (strComputer, strNamespace, strUser, strPassword) > objWMIService.Security_.authenticationLevel = > WbemAuthenticationLevelPktPrivacy > > ' > ================================================== =================== > winmgmt1 = "winmgmts:{impersonationLevel=impersonate}!//"& strComputer &"" > Set SerialN = GetObject( winmgmt1 ).InstancesOf ("Win32_BIOS") > > For each Serial in SerialN > WScript.Echo "Serial Number: " & Serial.SerialNumber > Next > > Const ForWriting = 2 > > Dim strFileHeader, strFileContents, strSomeLineDataCSVFormatted > Dim strFilePath > > strFilePath = "c:\scripts\testfile.csv" > strFileHeader = "MachineName,OS,SerialNumber" > strFileContents = strFileHeader & vbCrLf > strFileContents = strFileContents & strSomeDataCSVFormatted & vbCrLf > Set objFSO = CreateObject("Scripting.FileSystemObject") > Set objFileCreate = objFSO.CreateTextFile(strFilePath) > objFileCreate.Close > Set objFileWrite = objFSO.OpenTextFile(strFilePath, ForWriting) > objFileWrite.Write strFileContents > objFileWrite.Close > > ' > ================================================== =================== > > Set colItems = objWMIService.ExecQuery _ > ("Select * From Win32_OperatingSystem") > For Each objItem in ColItems > Wscript.Echo strComputer & ": " & objItem.Caption > Next > > ' > ================================================== =================== > ' End > ' > ================================================== =================== > > Else > Wscript.Echo strComputer & " could be not reached." > End If > Loop > Next > > ----------------------------------------------- > > > > "dveit" wrote: > > For previous tasks like this I usually just build out the file contents > > using a CSV format, create the text file with a .csv file extension, then > > write the contents to the file. Sample: > > > Const ForWriting = 2 > > > Dim strFileHeader, strFileContents, strSomeLineDataCSVFormatted > > Dim strFilePath > > > strFilePath = "c:\testfile.csv" > > strFileHeader = "MachineName,OS,SerialNumber" > > strFileContents = strFileHeader & vbCrLf > > strFileContents = strFileContents & strSomeDataCSVFormatted & vbCrLf > > Set objFSO = CreateObject("Scripting.FileSystemObject") > > Set objFileCreate = objFSO.CreateTextFile(strFilePath) > > objFileCreate.Close > > Set objFileWrite = objFSO.OpenTextFile(strFilePath, ForWriting) > > objFileWrite.Write strFileContents > > objFileWrite.Close- Hide quoted text - > > - Show quoted text - When you run your script run it under cscript, ie : C:\>cscript script.vbs run cscript alone to see usage, such as cscript //h:cscript to make cscript your default host |
|
|
|
#5 |
|
Messages: n/a
Hébergeur: |
On Oct 9, 9:09 pm, Hickory <Hick...@discussions.microsoft.com> wrote:
> Thank you so much for that, Dveit. It now sucessfully writes a csv file ![]() > But I can't get is to write the data that I need into the file. Not only > that, Every time it can't ping a computer, a dialog box pops up, when it > finds a serial # a box pops up, when it finds the OS version, a box pops up > and I have to click ok every time that happens. Is there a way to have a > simple "Please wait..." and not have anything pop up and have it write all > information to the file? > > I am very new at writing vbs and I know next to nothing about its commands > that correspond with WMI. I am very good at writing dos batch files, but I > can't get the results I want with that method. > > My current code is as follows: > again, thank you very much for the response > ---------------------------------------------- > > On Error Resume Next > > intStartingAddress = 1 > intEndingAddress = 255 > strSubnet = "192.168.90." > > Const WbemAuthenticationLevelPktPrivacy = 6 > > strCredentials = InputBox _ > ("Please enter the user name, a blank space, and then the password:", _ > "Enter User Credentials") > > If strCredentials = "" Then > Wscript.Quit > End If > > arrCredentials = Split(strCredentials," ") > strUser = arrCredentials(0) > strPassword = arrCredentials(1) > strNamespace = "root\cimv2" > > For i = intStartingAddress to intEndingAddress > strComputer = strSubnet & i > > Set objShell = CreateObject("WScript.Shell") > strCommand = "%comspec% /c ping -n 2 -w 300 " & strComputer & "" > Set objExecObject = objShell.Exec(strCommand) > > Do While Not objExecObject.StdOut.AtEndOfStream > strText = objExecObject.StdOut.ReadAll() > If Instr(strText, "Reply") > 0 Then > > Set objWbemLocator = CreateObject("WbemScripting.SWbemLocator") > Set objWMIService = objwbemLocator.ConnectServer _ > (strComputer, strNamespace, strUser, strPassword) > objWMIService.Security_.authenticationLevel = > WbemAuthenticationLevelPktPrivacy > > ' > ================================================== =================== > winmgmt1 = "winmgmts:{impersonationLevel=impersonate}!//"& strComputer &"" > Set SerialN = GetObject( winmgmt1 ).InstancesOf ("Win32_BIOS") > > For each Serial in SerialN > WScript.Echo "Serial Number: " & Serial.SerialNumber > Next > > Const ForWriting = 2 > > Dim strFileHeader, strFileContents, strSomeLineDataCSVFormatted > Dim strFilePath > > strFilePath = "c:\scripts\testfile.csv" > strFileHeader = "MachineName,OS,SerialNumber" > strFileContents = strFileHeader & vbCrLf > strFileContents = strFileContents & strSomeDataCSVFormatted & vbCrLf > Set objFSO = CreateObject("Scripting.FileSystemObject") > Set objFileCreate = objFSO.CreateTextFile(strFilePath) > objFileCreate.Close > Set objFileWrite = objFSO.OpenTextFile(strFilePath, ForWriting) > objFileWrite.Write strFileContents > objFileWrite.Close > > ' > ================================================== =================== > > Set colItems = objWMIService.ExecQuery _ > ("Select * From Win32_OperatingSystem") > For Each objItem in ColItems > Wscript.Echo strComputer & ": " & objItem.Caption > Next > > ' > ================================================== =================== > ' End > ' > ================================================== =================== > > Else > Wscript.Echo strComputer & " could be not reached." > End If > Loop > Next > > ----------------------------------------------- > > > > "dveit" wrote: > > For previous tasks like this I usually just build out the file contents > > using a CSV format, create the text file with a .csv file extension, then > > write the contents to the file. Sample: > > > Const ForWriting = 2 > > > Dim strFileHeader, strFileContents, strSomeLineDataCSVFormatted > > Dim strFilePath > > > strFilePath = "c:\testfile.csv" > > strFileHeader = "MachineName,OS,SerialNumber" > > strFileContents = strFileHeader & vbCrLf > > strFileContents = strFileContents & strSomeDataCSVFormatted & vbCrLf > > Set objFSO = CreateObject("Scripting.FileSystemObject") > > Set objFileCreate = objFSO.CreateTextFile(strFilePath) > > objFileCreate.Close > > Set objFileWrite = objFSO.OpenTextFile(strFilePath, ForWriting) > > objFileWrite.Write strFileContents > > objFileWrite.Close- Hide quoted text - > > - Show quoted text - When you run your script run it under cscript, ie : C:\>cscript script.vbs run cscript alone to see usage, such as cscript //h:cscript to make cscript your default host -J www.pooradmin.com |
|
![]() |
| Outils de la discussion | |
|
|