Question

Windows Script Host (WSH) facilitates developing scripts for Windows 10 using scripting languages such as Visual...

Windows Script Host (WSH) facilitates developing scripts for Windows 10 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

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 computer

Homework Answers

Answer #1
 1.  Set objNetwork = CreateObject("Wscript.Network") Wscript.Echo "The current user is " & objNetwork.UserName Wscript.Echo "Computer Name is " & objNetwork.ComputerName Wscript.Echo "Domain Name is " & objNetwork.UserDomain Set objShell = CreateObject("WScript.Shell") userProfilePath = objShell.ExpandEnvironmentStrings("%UserProfile%") Wscript.Echo userProfilePath 2. strComputer = "." Set objWMIService = GetObject("winmgmts:" _     & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") Set colInstalledPrinters =  objWMIService.ExecQuery _     ("Select * from Win32_Printer") For Each objPrinter in colInstalledPrinters     Wscript.Echo "Name: " & objPrinter.Name     Wscript.Echo "Location: " & objPrinter.Location     Wscript.Echo "Default: " & objPrinter.Default Next  
Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT