Windows Script Host (WSH) facilitates developing scripts for Windows 7 using scr
ID: 3594812 • Letter: W
Question
Windows Script Host (WSH) facilitates developing scripts for Windows 7 using scripting languages such as Visual Basic
. a. Write down a visual basic script (hw3_yourlastname2.vbs) which will display the current user’s login name, computer name, domain name and user profile (home folder) in a message box (20%)
b. Write down a visual basic script (hw3_yourlastname3.vbs) which will list all the printers (including virtual ones such as Adobe Writer) and their assigned port(s) defined on your machine (20%)
Explanation / Answer
a) visual basic script is as follows:
Set objNet = CreateObject("WScript.NetWork")
Dim stringInfo
stringInfo = "UserDomain " & objNet.UserName & vbCRLF & _
"PC Name " & objNet.ComputerName & vbCRLF & _
"DomainName " & objNet.UserDomain
MsgBox stringInfo
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.