Earlier today I used a VBS script to scrub all the email addresses from a Windows Exchange server since I couldn’t find any other way to display all email addresses including any aliases assigned to specific users. I needed to find a secondary email address from one of the many domains configured on the server so I could remove it from a user and add it to another user. Anyhow when run the script would pop up this huge window that did not include scrollbars so it was impossible to find what I was looking for. Use the information below to output VBS script output to a text file on a Windows computer.
Output VBS Script to Text On Windows:
In the Linux world you could do something like “./<script name> >> file.txt” but this wasn’t working for me on Windows. The trick was actually easy enough though and I was able to accomplish my goal by simply using cscript and adding the entire path to the text file. So if the script was ListAllEmails.vbs you could use the below syntax to put the script output to emails.txt in the root of the C drive on Windows.
- cscript ListAllEmails.vbs > C:\emails.txt
Now you can open emails.txt located in the root of the C drive and this will be the output of the ListAllEmails.vbs script. Easy enough but without knowing about cscript it may be hard to accomplish.