{"id":112,"date":"2017-04-27T14:17:40","date_gmt":"2017-04-27T12:17:40","guid":{"rendered":"http:\/\/blog.van-daag.nl\/?p=112"},"modified":"2017-07-25T18:14:14","modified_gmt":"2017-07-25T18:14:14","slug":"netsend-with-pstools","status":"publish","type":"post","link":"https:\/\/van-daag.nl\/?p=112","title":{"rendered":"Netsend with PStools"},"content":{"rendered":"<p>I created this script to send a message to all of our managed systems if there are problems and email is not working.<\/p>\n<p>Here is the overview of the files what you need.<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-133 size-full\" src=\"https:\/\/i0.wp.com\/blog.van-daag.nl\/wp-content\/uploads\/2017\/04\/Nedsend-1.jpg?resize=602%2C93\" alt=\"\" width=\"602\" height=\"93\" srcset=\"https:\/\/i0.wp.com\/van-daag.nl\/wp-content\/uploads\/2017\/04\/Nedsend-1.jpg?w=602&amp;ssl=1 602w, https:\/\/i0.wp.com\/van-daag.nl\/wp-content\/uploads\/2017\/04\/Nedsend-1.jpg?resize=300%2C46&amp;ssl=1 300w\" sizes=\"auto, (max-width: 602px) 100vw, 602px\" \/><\/p>\n<p>The computer.txt is the list of all hostnames where you want to send message.<\/p>\n<p>PsExec you can download at <a href=\"https:\/\/technet.microsoft.com\/en-us\/sysinternals\/pstools.aspx\">Microsoft<\/a>.<\/p>\n<p>readme.txt is a short manual how to use it for other people<\/p>\n<p>The startmij.cmd file below you can only run when the files are local on the system with UAC enabled and tested only with Windows 7. And you need to have local admin rights on all of the domain computers.<\/p>\n<pre class=\"lang:batch decode:true \" title=\"Sent network message\">@echo off\r\nREM ########################################################\r\nREM ## Created by Daag van der Meer                     ##\r\nREM ########################################################\r\n\r\nREM ###########################################################\r\nREM ## CHECKING FOR ADMIN                                    ##\r\nREM ###########################################################\r\n&gt;nul 2&gt;&amp;1 \"%SYSTEMROOT%\\system32\\cacls.exe\" \"%SYSTEMROOT%\\system32\\config\\system\"\r\nREM --&gt; If error flag set, we do not have admin.\r\nif '%errorlevel%' NEQ '0' (\r\n    echo Requesting administrative privileges...\r\n    goto UACPrompt\r\n) else ( goto gotAdmin )\r\n:UACPrompt\r\n    echo Set UAC = CreateObject^(\"Shell.Application\"^) &gt; \"%temp%\\getadmin.vbs\"\r\n    echo UAC.ShellExecute \"%~s0\", \"\", \"\", \"runas\", 1 &gt;&gt; \"%temp%\\getadmin.vbs\"\r\n    \"%temp%\\getadmin.vbs\"\r\n    exit \/B\r\n:gotAdmin\r\n    if exist \"%temp%\\getadmin.vbs\" ( del \"%temp%\\getadmin.vbs\" )\r\n    pushd \"%CD%\"\r\n    CD \/D \"%~dp0\"\r\nREM ###########################################################\r\nREM ## End Checking for ADMIN                                ##\r\nREM ###########################################################\r\n\r\n:START\r\ncls\r\nEcho ###########################################################\r\nEcho ## Hiermee stuur je een popupmelding naar elke pc die    ##\r\necho ## in computers.txt vermeld staat.                       ##\r\necho ###########################################################\r\necho.\r\nEcho Voer de tekst in wat je wilt versturen naar alle pc's.\r\necho.\r\nset \/p text=Je tekst:\r\ncls\r\nset \/p tijd=Hoeveel seconden moet dit bericht blijven staan:\r\ncls\r\necho Uw ingevoerde tekst:\r\necho %text%\r\necho.\r\necho Tijdweergave van dit bericht in secondes\r\necho %tijd%\r\necho.\r\nset\/p KEUZE=Klopt dit? (J)a, N(ee)\r\nif \"%KEUZE%\"==\"j\" goto STUURMSG\r\nif \"%KEUZE%\"==\"J\" goto STUURMSG\r\nif \"%KEUZE%\"==\"n\" goto START\r\nif \"%KEUZE%\"==\"N\" goto START\r\n\r\n:STUURMSG\r\n@echo on\r\nPsExec.exe -n 20 @computers.txt msg * \/time:%tijd% %text%<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>I created this script to send a message to all of our managed systems if there are problems and email is not working. Here is the overview of the files what you need. The computer.txt is the list of all hostnames where you want to send message. PsExec you can download at Microsoft. readme.txt is [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[7,12,20],"tags":[],"class_list":["post-112","post","type-post","status-publish","format-standard","hentry","category-ms-dos-scripts","category-pstools","category-windows-7"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/van-daag.nl\/index.php?rest_route=\/wp\/v2\/posts\/112","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/van-daag.nl\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/van-daag.nl\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/van-daag.nl\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/van-daag.nl\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=112"}],"version-history":[{"count":1,"href":"https:\/\/van-daag.nl\/index.php?rest_route=\/wp\/v2\/posts\/112\/revisions"}],"predecessor-version":[{"id":211,"href":"https:\/\/van-daag.nl\/index.php?rest_route=\/wp\/v2\/posts\/112\/revisions\/211"}],"wp:attachment":[{"href":"https:\/\/van-daag.nl\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=112"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/van-daag.nl\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=112"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/van-daag.nl\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=112"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}