Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
do while true
sComputer=inputbox("Enter the computer name or its ip address : -" & vbcrlf & vbcrlf & _
"Local computer can be ""."" or ""127.0.0.1""", _
"Search for default printer on a Computer",".")
if IsEmpty(sComputer) then wscript.echo "Operation is aborted by user." : wscript.quit(1)
if defaultprtr(sComputer, defaultprintername)=0 then
if sComputer="." or sComputer="127.0.0.1" then sNameComp="Localhost" else sNameComp=sComputer
if isempty(defaultprintername) then
msg="Computer " & sNameComp & " does not have an assigned default printer."
else
msg="Computer " & sNameComp & " has an assigned default printer : " & defaultprintername & "."
end if
else
msg="Computer cannot be reached for various reason."
end if
wscript.echo msg
loop
function defaultprtr(shost, prtrname)
defaultprtr=0 'error-less return
prtrname="" 'out-param
on error resume next
set svc=getobject("winmgmts:\\" & shost & "\root\cimv2")
set cprtr=svc.execquery("select name, attributes from win32_printer")
for each oprtr in cprtr
if (oprtr.attributes and &h04)=&h04 then prtrname=oprtr.name : exit for
next
if err.number<>0 then defaultprtr=err.number : err.clear : prtrname=""
on error goto 0
set cprt=nothing : set svc=nothing
end function