For Loop - Str Assignment

Anything VBScript-related, including Windows Script Host, WMI, ADSI, and more.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 16 years and 6 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
new_user
Posts: 157
Last visit: Tue May 06, 2014 5:46 pm

For Loop - Str Assignment

Post by new_user »

In the attached code I am missing something where the wscript.echo command works fine but I am trying to capture the list of what is echo'd into a variable or two and add it into the body of the email portion of the script. I get the last two entries without issue, but cannot seem to get a variable to capture the entire wscript.echo so I can send it in the email. The output to screen looks similiar to:

cluster name
server1 spooler1
server1 spooler 2
server2 applicationx

Thanks in advance for any help.uploads/7804/cluster_resource.txt
User avatar
new_user
Posts: 157
Last visit: Tue May 06, 2014 5:46 pm

For Loop - Str Assignment

Post by new_user »

In the attached code I am missing something where the wscript.echo command works fine but I am trying to capture the list of what is echo'd into a variable or two and add it into the body of the email portion of the script. I get the last two entries without issue, but cannot seem to get a variable to capture the entire wscript.echo so I can send it in the email. The output to screen looks similiar to:

cluster name
server1 spooler1
server1 spooler 2
server2 applicationx

Thanks in advance for any help.uploads/7804/cluster_resource.txt
User avatar
jdelatorre@hfinc.com
Posts: 54
Last visit: Wed Jan 30, 2008 1:42 am

For Loop - Str Assignment

Post by jdelatorre@hfinc.com »

If Im right about what I think your trying to do i think you need to create a holder variable. Something like this in your For Each Loop.strVar = ""For Each objResGroupName In objClusterCon.ResourceGroups strResGroupName = objResGroupName.Name 'WScript.Echo strResGroupName 'WScript.Echo "Active Node for the " & strResGroupName & " Resource Group = " & objClusterCon.ResourceGroups.Item(strResGroupName).OwnerNode.Name strVar = strVar & objClusterCon.ResourceGroups.Item(strResGroupName).OwnerNode.Name & ": " & strResGroupName & vbcrlf NextstrBody = strVar
This topic is 16 years and 6 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked