{"id":12902,"date":"2021-12-10T07:44:23","date_gmt":"2021-12-10T07:44:23","guid":{"rendered":"https:\/\/lgildv5i97.onrocket.site\/answers\/?post_type=question&#038;p=12902"},"modified":"2021-12-10T07:45:16","modified_gmt":"2021-12-10T07:45:16","slug":"solved-script-to-check-computer-and-install-printer","status":"publish","type":"question","link":"https:\/\/computing.net\/answers\/programming\/script-to-check-computer-and-install-printer\/28846.html","title":{"rendered":"Solved Script To Check Computer And Install Printer"},"content":{"rendered":"<p>Hi<\/p>\n<p>Can someone help me put some codes together please, I already have a script which I would like to add a check and install or not install to it.<\/p>\n<p>ComputerName= LCase(WshNetwork.ComputerName)<br \/>\nShortName = Left(ComputerName, 16)<br \/>\nSelect Case ShortName<br \/>\nCase&#8221;computer1&#8243;<br \/>\nwshnetwork.addwindowsprinterconnection &#8220;\\\\pserver\\printer1&#8221;<br \/>\nwshnetwork.addwindowsprinterconnection &#8220;\\\\pserver\\colourprinter1&#8221;<br \/>\nWshNetwork.SetDefaultPrinter &#8220;\\\\pserver\\printer1&#8243;<br \/>\nCase&#8221;computer2&#8221;<br \/>\nwshnetwork.addwindowsprinterconnection &#8220;\\\\pserver\\printer2&#8221;<br \/>\nwshnetwork.addwindowsprinterconnection &#8220;\\\\pserver\\colourprinter2&#8221;<br \/>\nWshNetwork.SetDefaultPrinter &#8220;\\\\pserver\\printer2&#8243;<br \/>\nCase&#8221;computer3&#8221;<br \/>\nwshnetwork.addwindowsprinterconnection &#8220;\\\\pserver\\printer3&#8221;<br \/>\nwshnetwork.addwindowsprinterconnection &#8220;\\\\pserver\\colourprinter3&#8221;<br \/>\nWshNetwork.SetDefaultPrinter &#8220;\\\\pserver\\printer3&#8221;<br \/>\nCase Else<br \/>\nREM WScript.Echo &#8220;Problem determining PC location.&#8221;<br \/>\nEnd Select<\/p>\n<p>This vbs script is run when a user logins and it will check the computer name and if it matches installed 2 printers and make one of them the default, I want it to check if the computer already have this printer installed and if so don&#8217;t install it and check the second one and again don&#8217;t install it if it&#8217;s installed already and so on checking all the machines.<\/p>\n<p>Thanks<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"inline_featured_image":false,"iawp_total_views":14},"question-category":[55],"question_tags":[],"class_list":["post-12902","question","type-question","status-publish","hentry","question-category-programming"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question\/12902","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question"}],"about":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/types\/question"}],"author":[{"embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/comments?post=12902"}],"wp:attachment":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/media?parent=12902"}],"wp:term":[{"taxonomy":"question-category","embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question-category?post=12902"},{"taxonomy":"question_tags","embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question_tags?post=12902"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}