![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Calling Executable from VBScript I wrote a script to gather information about the current user logged into the computer. I need to get the computer SID, and have only had accurate results from calling PSGetSID. How can I call PSGetSID with out opening up a shell and write the output to a text file. Here is my first try at this, which flashes up a empty shell, (contains only part of the code of the entire script): Set objShell = CreateObject("WScript.Shell") strCommand = localpath & "H:\psgetsid.exe " & strComputer Set objExecObject = objShell.Exec(strCommand) Do While Not objExecObject.StdOut.AtEndOfStream strText = objExecObject.StdOut.ReadAll() loop objTextFile.WriteLine("Computer SID: " & VbTab & VbTab & strText) objTextFile.Close |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Calling Executable from VBScript "sweetsilver99" <edvoroznak@xxxxxx> wrote in message news:55f04b33-8fac-4950-914e-b2bb661b3e85@xxxxxx Quote: >I wrote a script to gather information about the current user logged > into the computer. I need to get the computer SID, and have only had > accurate results from calling PSGetSID. How can I call PSGetSID with > out opening up a shell and write the output to a text file. Here is > my first try at this, which flashes up a empty shell, (contains only > part of the code of the entire script): > > Set objShell = CreateObject("WScript.Shell") > strCommand = localpath & "H:\psgetsid.exe " & strComputer > Set objExecObject = objShell.Exec(strCommand) > Do While Not objExecObject.StdOut.AtEndOfStream > strText = objExecObject.StdOut.ReadAll() > loop > objTextFile.WriteLine("Computer SID: " & VbTab & VbTab & strText) > objTextFile.Close How Can I Modify the Output of the Ping Command - http://www.microsoft.com/technet/scr...6/hey0817.mspx |
My System Specs![]() |
| | #3 (permalink) |
| | Re: Calling Executable from VBScript On Nov 4, 9:06*am, "Pegasus \(MVP\)" <I....@xxxxxx> wrote: Quote: > "sweetsilver99" <edvoroz...@xxxxxx> wrote in message > > news:55f04b33-8fac-4950-914e-b2bb661b3e85@xxxxxx > Quote: > >I wrote a script to gather information about the current user logged > > into the computer. *I need to get the computer SID, and have only had > > accurate results from calling PSGetSID. *How can I call PSGetSID with > > out opening up a shell and write the output to a text file. *Here is > > my first try at this, which flashes up a empty shell, (contains only > > part of the code of the entire script): Quote: > > * * * * * * * *Set objShell = CreateObject("WScript.Shell") > > strCommand = localpath & "H:\psgetsid.exe " & strComputer > > Set objExecObject = objShell.Exec(strCommand) > > Do While Not objExecObject.StdOut.AtEndOfStream > > strText = objExecObject.StdOut.ReadAll() > > loop > > objTextFile.WriteLine("Computer SID: " & VbTab & VbTab & strText) > > objTextFile.Close > Have a look at this example published by the Scripting Guy: > How Can I Modify the Output of the Ping Command -http://www.microsoft.com/technet/scriptcenter/resources/qanda/aug06/h... to not pop open. I found this following information maybe this will work: http://publib.boulder.ibm.com/infoce...610uaref89.htm Note: The "0" parameter in the following oshell.run commands is used to hide the ' shell-created DOS command window. The "true" parameter means to halt script ' execution until the called program finishes and returns control. rc = oshell.run("kumpping", 0, true) if rc <> 0 then wscript.echo "Status from kumpping is " & rc wscript.echo "Verify that the Universal Agent API Data Provider is active. Exiting..." wscript.quit end if |
My System Specs![]() |
| | #4 (permalink) |
| | Re: Calling Executable from VBScript "sweetsilver99" <edvoroznak@xxxxxx> wrote in message news:b61913b6-12b7-4cdb-81ba-0420ee805ce9@xxxxxx On Nov 4, 9:06 am, "Pegasus \(MVP\)" <I....@xxxxxx> wrote: Quote: > "sweetsilver99" <edvoroz...@xxxxxx> wrote in message > > news:55f04b33-8fac-4950-914e-b2bb661b3e85@xxxxxx > Quote: > >I wrote a script to gather information about the current user logged > > into the computer. I need to get the computer SID, and have only had > > accurate results from calling PSGetSID. How can I call PSGetSID with > > out opening up a shell and write the output to a text file. Here is > > my first try at this, which flashes up a empty shell, (contains only > > part of the code of the entire script): Quote: > > Set objShell = CreateObject("WScript.Shell") > > strCommand = localpath & "H:\psgetsid.exe " & strComputer > > Set objExecObject = objShell.Exec(strCommand) > > Do While Not objExecObject.StdOut.AtEndOfStream > > strText = objExecObject.StdOut.ReadAll() > > loop > > objTextFile.WriteLine("Computer SID: " & VbTab & VbTab & strText) > > objTextFile.Close > Have a look at this example published by the Scripting Guy: > How Can I Modify the Output of the Ping > Command -http://www.microsoft.com/technet/scriptcenter/resources/qanda/aug06/h... to not pop open. I found this following information maybe this will work: http://publib.boulder.ibm.com/infoce...610uaref89.htm Note: The "0" parameter in the following oshell.run commands is used to hide the ' shell-created DOS command window. The "true" parameter means to halt script ' execution until the called program finishes and returns control. rc = oshell.run("kumpping", 0, true) if rc <> 0 then wscript.echo "Status from kumpping is " & rc wscript.echo "Verify that the Universal Agent API Data Provider is active. Exiting..." wscript.quit end if The Run method accepts up to 3 parameters, only the first is required. If the second parameter is 0 the app runs hidden. 1 means normal (default), 2 minimized, 3 maximized. There seems to be nothing similar for the Exec command. -- Richard Mueller MVP Directory Services Hilltop Lab - http://www.rlmueller.net -- |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Calling a VBScript from Access | VB Script | |||
| calling WinAPIs from VBScript | VB Script | |||
| Running an executable within a VBscript | VB Script | |||
| Vbscript calling DTS package | VB Script | |||
| Error handling when calling external executable | PowerShell | |||