Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Wmi echo

Status
Not open for further replies.

ajtsystems

IS-IT--Management
Jan 15, 2009
80
GB
Hi I have a WMI collection as below:

Set objSWbemLocator = CreateObject("WbemScripting.SWbemLocator")
if instr (strComputer, "localhost") then
Set objSWbemServices = objSWbemLocator.ConnectServer (strComputer, "root\WebAdministration", ms406)
else
Set objSWbemServices = objSWbemLocator.ConnectServer (strComputer, "root\WebAdministration", "james", "jamesjames1", ms406)

end if
'
objSWbemServices.Security_.authenticationLevel = 6
Set colitems = objSWbemServices.ExecQuery("Select * From virtualdirectory")


' inputbox which creates the backup folder if its not already there


for each objapp in colitems

arrMem = array(objapp.physicalpath)

for i = 0 to UBound(arrMem)

call backup (arrmem(i), backupdir)
'call DeleteWebConfigb4Copy (backupdir, arrmem(i))
next


So, for each item in teh collection I can echo it to the screen, question is can I echo them all at once in one message box.

I want to do this so that I can notify users of the collection...

Thanks
 
Create a variable to hold the information of interest, in the for each loop concatenate the new information to the existing variable. After the loop, echo back the saved variable.

Pseudo code follows:
Code:
Dim strInfo
for each item in collection
  strInfo = strInfo & item.information & vbcrlf
next

wscript.echo strInfo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top