I am trying to pull ipconfig /all
output and put it into a text file. I have created a small VBScript that runs ipconfig
without issues. Then I call it in another VBScript. All of this runs, but the output text file remains empty and the primary VBScript doesn't seem to write anything after the ipconfig.vbs
runs.
Here is the sample from the primary .vbs script:
' Pulling network config
Set objFSO = WScript.CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.CreateTextFile("C:\Users\dsadmin\Desktop\LogNet\network_config.txt", 8)
set objFile = objFSO.OpenTextFile("C:\Users\dsadmin\Desktop\LogNet\network_config.txt")
objShell.Run("cscript //nologo C:\Users\dsadmin\Downloads\ipconfig.vbs >C:\Users\dsadmin\Desktop\LogNet\network_config.txt")
Here is the script it calls (ipconfig.vbs):
Set objShell = CreateObject("WScript.Shell")
objShell.Run("ipconfig /all")
I'm out of ideas when it comes to shuffling things around.