{"id":328,"date":"2016-05-25T12:07:37","date_gmt":"2016-05-25T11:07:37","guid":{"rendered":"http:\/\/www.adienicholls.co.uk\/blogs\/?p=328"},"modified":"2017-03-11T19:53:31","modified_gmt":"2017-03-11T19:53:31","slug":"ms-windows-remote-installs","status":"publish","type":"post","link":"http:\/\/www.adienicholls.co.uk\/blog\/ms-windows-remote-installs\/","title":{"rendered":"MS Windows Remote Installs"},"content":{"rendered":"<p>Use this script to run a program remotely. In this scenario the script is used to install IE9 onto a remote MS Windows 7 machine.<\/p>\n<p>PSTools <a href=\"https:\/\/www.google.co.uk\/url?sa=t&amp;rct=j&amp;q=&amp;esrc=s&amp;source=web&amp;cd=1&amp;ved=0ahUKEwiy757L-vTMAhVeFMAKHWPqDK8QFggdMAA&amp;url=https%3A%2F%2Ftechnet.microsoft.com%2Fen-us%2Fsysinternals%2Fpstools.aspx&amp;usg=AFQjCNHvHb7qy1FBrDGNG-ytDptKKUTB1w\" target=\"_blank\">Download Link<\/a><\/p>\n<h2>How to use:<\/h2>\n<p>Save the below script as a &#8216;.bat&#8217; file.<br \/>\nUpdate the script to reflect the network share where the IE9 (or other) install \/ upgrade package is stored.<\/p>\n<p>On running the script you will be shown a CMD box asking for an asset tag (also known as hostname). Enter the PC asset tag, select Enter&#8230; The Script will connect to the remote computer, copy the installation file over to a C:\\temp folder, run the installer using the switches provided and the delete the file once completed.<\/p>\n<p>The script should return an &#8216;error&#8217; code of 0, this means the installation completed with no issues.<\/p>\n<p>&nbsp;<\/p>\n<pre>@echo off\r\nREM *********************************************\r\nREM A.Nicholls\r\nREM http:\/\/www.adienicholls.co.uk\/blogs\r\nREM 25\/05\/2016\r\nREM *********************************************\r\n\r\nREM Get remote PCs hostname\r\nset \/p id=Enter Hostname:\r\n\r\nREM Copy the install file from source to destination PC\r\nrobocopy \\\\Server\\shared\\ms\\ie9 \\\\%id%\\c$\\temp\\ *.exe \/r:0 \/w:0\r\n\r\nREM executes the copied file through CMD\r\npsexec \\\\%id% cmd.exe \/c \"c:\\temp\\IE9-Windows7-x86-enu.exe\" \/quiet \/closeprograms \/update-no \/norestart\r\n\r\nREM verifying return codes\r\nECHO ________________________________________________________________\r\nECHO (1)\u00a0\u00a0\u00a0\u00a0 Error, opps something went wrong\r\nECHO (0)\u00a0\u00a0\u00a0\u00a0 Installation Succeeded\r\nECHO ________________________________________________________________\r\n\r\nREM Cleanup - Delete the previously copied file\r\npsexec \\\\%id% cmd.exe \/c DEL \"c:\\temp\\IE9-Windows7-x86-enu.exe\" \/q\r\n\r\nREM providing a cleaner exit code for the file deletion\r\nif ERRORLEVEL 1 echo *****OOPS, couldnt remove the file*****\r\nif ERRORLEVEL 0 echo cleanup completed\r\n\r\npause<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Use this script to run a program remotely. In this scenario the script is used to install IE9 onto a remote MS Windows 7 machine. PSTools Download Link How to use: Save the below script as a &#8216;.bat&#8217; file. Update the script to reflect the network share where the IE9 (or other) install \/ upgrade &hellip; <a href=\"http:\/\/www.adienicholls.co.uk\/blog\/ms-windows-remote-installs\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">MS Windows Remote Installs<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":326,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[15,178],"tags":[],"_links":{"self":[{"href":"http:\/\/www.adienicholls.co.uk\/blog\/wp-json\/wp\/v2\/posts\/328"}],"collection":[{"href":"http:\/\/www.adienicholls.co.uk\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.adienicholls.co.uk\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.adienicholls.co.uk\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/www.adienicholls.co.uk\/blog\/wp-json\/wp\/v2\/comments?post=328"}],"version-history":[{"count":2,"href":"http:\/\/www.adienicholls.co.uk\/blog\/wp-json\/wp\/v2\/posts\/328\/revisions"}],"predecessor-version":[{"id":330,"href":"http:\/\/www.adienicholls.co.uk\/blog\/wp-json\/wp\/v2\/posts\/328\/revisions\/330"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/www.adienicholls.co.uk\/blog\/wp-json\/wp\/v2\/media\/326"}],"wp:attachment":[{"href":"http:\/\/www.adienicholls.co.uk\/blog\/wp-json\/wp\/v2\/media?parent=328"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.adienicholls.co.uk\/blog\/wp-json\/wp\/v2\/categories?post=328"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.adienicholls.co.uk\/blog\/wp-json\/wp\/v2\/tags?post=328"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}