{"id":5668,"date":"2018-12-12T10:40:49","date_gmt":"2018-12-12T07:40:49","guid":{"rendered":"https:\/\/msbro.ru\/?p=5668"},"modified":"2018-12-12T10:41:11","modified_gmt":"2018-12-12T07:41:11","slug":"otpravka-sms-soobshheniya-cherez-powershell-na-gsm-2g-3g-4g-modem","status":"publish","type":"post","link":"https:\/\/msbro.ru\/index.php\/archives\/5668","title":{"rendered":"\u041e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 SMS \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0447\u0435\u0440\u0435\u0437 PowerShell \u043d\u0430 GSM \/ 2G \/3G \/4G \u043c\u043e\u0434\u0435\u043c"},"content":{"rendered":"<p>\u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0447\u0435\u0440\u0435\u0437 GSM \u043c\u043e\u0434\u0435\u043c \u0442\u043e \u044d\u0442\u043e \u043b\u0435\u0433\u043a\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e PowerShell.<\/p>\n<p>\u0421\u043a\u0440\u0438\u043f\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u043b \u0447\u0435\u0440\u0435\u0437 USB-\u0441\u0432\u0438\u0441\u0442\u043a\u0438 \u0438 \u043e\u0431\u044b\u043a\u043d\u043e\u0432\u0435\u043d\u043d\u044b\u0439 \u043c\u043e\u0434\u0435\u043c \u0441 COM \u043f\u043e\u0440\u0442\u043e\u043c.<\/p>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u0447\u0442\u043e \u043c\u043e\u0434\u0435\u043c\u044b \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u0435\u0439 \u043c\u043e\u0433\u0443\u0442 \u043f\u043e\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u0442\u044c \u0441\u043c\u0435\u043d\u0438\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0442\u0430\u0439\u043c\u0430\u0443\u0442\u043e\u0432 \u0438\u043b\u0438 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u043f\u043e\u0440\u0442\u0430.<\/p>\n<p>\u0412 \u043e\u0431\u0449\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e \u0441\u043a\u0440\u0438\u043f\u0442 \u043e\u0442\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043b \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0430 \u043b\u044e\u0431\u043e\u043c \u043c\u043e\u0434\u0435\u043c\u0435.<\/p>\n<p><!--more--><br \/>\n\u0423\u0442\u043e\u0447\u043d\u0438\u0442\u0435 \u043d\u043e\u043c\u0435\u0440 \u0432\u0430\u0448\u0435\u0433\u043e COM &#8211; \u043f\u043e\u0440\u0442\u0430 \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043c\u043e\u0434\u0435\u043c, \u0437\u0430\u043f\u0438\u0448\u0438\u0442\u0435 \u0432\u0430\u0448 \u043d\u043e\u043c\u0435\u0440 \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442\u0435 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c SMS \u0438 \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f.<\/p>\n<p>\u0421\u0430\u043c \u0441\u043a\u0440\u0438\u043f\u0442:<\/p>\n<pre class=\"\">$serialPort = new-Object System.IO.Ports.SerialPort\r\n$serialPort.PortName = \"COM9\"\r\n$serialPort.BaudRate = 19200\r\n$serialPort.WriteTimeout = 500\r\n$serialPort.ReadTimeout = 3000\r\n$serialPort.DtrEnable = \"true\"\r\n# Open the connection\r\n$serialPort.Open()\r\n# Add variables for phone number and the message.\r\n$phoneNumber = \"+7926000000\"\r\n$textMessage = \"GRRRRRRRRRR!!!\"\r\n\r\ntry {\r\n$serialPort.Open()\r\n}\r\ncatch {\r\nStart-Sleep -Seconds 5\r\n$serialPort.Open()\r\n}\r\nIf ($serialPort.IsOpen -eq $true) {\r\n$serialPort.Write(\"AT+CMGF=1`r`n\")\r\n$serialPort.Write(\"AT+CMGS=`\"$phoneNumber`\"`r`n\")\r\nStart-Sleep -Seconds 1\r\n$serialPort.Write(\"$textMessage`r`n\")\r\n# \u041e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 Ctrl+Z \u0434\u043b\u044f \u043a\u043e\u043d\u0446\u0430 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f.\r\n$serialPort.Write($([char] 26))\r\nStart-Sleep -Seconds 1\r\n}\r\n\r\n$serialPort.Close()\r\nif ($serialPort.IsOpen -eq $false) {\r\necho \"Port Closed!\"\r\n}<\/pre>\n<p>\u0423\u0434\u0430\u0447\u043d\u044b\u0445 \u0432\u0430\u043c \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u043e\u0432!<br \/>\n\u0423 \u0432\u0430\u0441 \u0432\u0441\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0447\u0435\u0440\u0435\u0437 GSM \u043c\u043e\u0434\u0435\u043c \u0442\u043e \u044d\u0442\u043e \u043b\u0435\u0433\u043a\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e PowerShell. \u0421\u043a\u0440\u0438\u043f\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u043b \u0447\u0435\u0440\u0435\u0437 USB-\u0441\u0432\u0438\u0441\u0442\u043a\u0438 \u0438 \u043e\u0431\u044b\u043a\u043d\u043e\u0432\u0435\u043d\u043d\u044b\u0439 \u043c\u043e\u0434\u0435\u043c \u0441 COM \u043f\u043e\u0440\u0442\u043e\u043c. \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u0447\u0442\u043e \u043c\u043e\u0434\u0435\u043c\u044b \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u0435\u0439 \u043c\u043e\u0433\u0443\u0442 \u043f\u043e\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u0442\u044c \u0441\u043c\u0435\u043d\u0438\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0442\u0430\u0439\u043c\u0430\u0443\u0442\u043e\u0432 \u0438\u043b\u0438 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u043f\u043e\u0440\u0442\u0430. \u0412 \u043e\u0431\u0449\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e \u0441\u043a\u0440\u0438\u043f\u0442 \u043e\u0442\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043b \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0430 \u043b\u044e\u0431\u043e\u043c \u043c\u043e\u0434\u0435\u043c\u0435.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10],"tags":[1875,520,1671,524,17,522,1874,90],"class_list":["post-5668","post","type-post","status-publish","format-standard","hentry","category-scripts","tag-2g","tag-3g","tag-4g","tag-gsm","tag-powershell","tag-modem","tag-otpravka-sms","tag-sms"],"_links":{"self":[{"href":"https:\/\/msbro.ru\/index.php\/wp-json\/wp\/v2\/posts\/5668"}],"collection":[{"href":"https:\/\/msbro.ru\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/msbro.ru\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/msbro.ru\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/msbro.ru\/index.php\/wp-json\/wp\/v2\/comments?post=5668"}],"version-history":[{"count":1,"href":"https:\/\/msbro.ru\/index.php\/wp-json\/wp\/v2\/posts\/5668\/revisions"}],"predecessor-version":[{"id":5669,"href":"https:\/\/msbro.ru\/index.php\/wp-json\/wp\/v2\/posts\/5668\/revisions\/5669"}],"wp:attachment":[{"href":"https:\/\/msbro.ru\/index.php\/wp-json\/wp\/v2\/media?parent=5668"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/msbro.ru\/index.php\/wp-json\/wp\/v2\/categories?post=5668"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/msbro.ru\/index.php\/wp-json\/wp\/v2\/tags?post=5668"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}<!-- WP Super Cache is installed but broken. The constant WPCACHEHOME must be set in the file wp-config.php and point at the WP Super Cache plugin directory. -->