{"id":349013,"date":"2023-06-19T15:01:24","date_gmt":"2023-06-19T15:01:24","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=349013"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=349013","title":{"rendered":"<span>\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u0442\u043e\u0432 \u0432 \u042d\u0414\u041e \u0447\u0435\u0440\u0435\u0437 API \u0421\u0411\u0418\u0421 \u0438 \u0414\u0438\u0430\u0434\u043e\u043a<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/506\/67a\/7a9\/50667a7a963ff0da2421e87afafb37ef.png\" width=\"650\" height=\"650\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/506\/67a\/7a9\/50667a7a963ff0da2421e87afafb37ef.png\"\/><\/figure>\n<p>\u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442. \u042d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0435\u0437\u043d\u0430 \u0442\u0435\u043c, \u043a\u0442\u043e \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0441\u044f \u0441 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439 \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a \u0434\u043e\u0432\u0435\u0440\u0435\u043d\u043d\u043e\u0441\u0442\u0435\u0439 \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u044b\u043c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u043e\u0431\u043e\u0440\u043e\u0442\u043e\u043c \u0447\u0435\u0440\u0435\u0437 \u0421\u0411\u0418\u0421 \u0438 \u0414\u0438\u0430\u0434\u043e\u043a.\u00a0 \u0420\u0435\u0447\u044c \u0438\u0434\u0435\u0442 \u043d\u0435 \u043e \u041c\u0427\u0414 (\u043c\u0430\u0448\u0438\u043d\u043e\u0447\u0438\u0442\u0430\u0435\u043c\u043e\u0439 \u0434\u043e\u0432\u0435\u0440\u0435\u043d\u043d\u043e\u0441\u0442\u0438), \u0430 \u043e \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0435 \u043e\u0431\u044b\u0447\u043d\u044b\u0445 \u0431\u0443\u043c\u0430\u0436\u043d\u044b\u0445 \u0434\u043e\u0432\u0435\u0440\u043e\u043a. <\/p>\n<p>\u0422\u0430\u043a \u0436\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043a\u043e\u043c\u0443 \u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0435\u0437\u043d\u043e \u043f\u043e\u0447\u0435\u0440\u043f\u043d\u0443\u0442\u044c \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u044b \u0440\u0430\u0431\u043e\u0442\u044b \u0447\u0435\u0440\u0435\u0437 API.<\/p>\n<p>\u041a\u043e \u043c\u043d\u0435 \u044d\u0442\u0430 \u0437\u0430\u0434\u0430\u0447\u0430 \u043f\u0440\u0438\u043b\u0435\u0442\u0435\u043b\u0430 \u043e\u0442 \u044e\u0440\u0438\u0441\u0442\u043e\u0432, \u043d\u0430\u0448\u0435\u0439 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u043b\u0438 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u044b \u0432\u0440\u0443\u0447\u043d\u0443\u044e. (\u0441\u043c\u043e\u0442\u0440\u0435\u043b\u0438 \u0432\u0440\u0443\u0447\u043d\u0443\u044e \u043a\u0435\u043c \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442 \u0438 \u043f\u043e\u0442\u043e\u043c \u0438\u0441\u043a\u0430\u043b\u0438 \u044d\u0442\u0443 \u0434\u043e\u0432\u0435\u0440\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u0432 \u0441\u043a\u0430\u043d\u0430\u0445. <\/p>\n<p>1.\u00a0\u041f\u0435\u0440\u0432\u043e\u0435 \u0447\u0442\u043e \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u044d\u0442\u043e \u0440\u0435\u0435\u0441\u0442\u0440 \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u0442\u043e\u0432 \u043a\u043e\u043d\u0442\u0440\u0430\u0433\u0435\u043d\u0442\u043e\u0432. \u0424\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0432 \u043f\u043e\u043b\u0443 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u043c \u0440\u0435\u0436\u0438\u043c\u0435, \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u043e\u043c \u043f\u043e\u0434\u0433\u0440\u0443\u0436\u0430\u0435\u0442\u0441\u044f: \u0424\u0418\u041e, \u0434\u043e\u043b\u0436\u043d\u043e\u0441\u0442\u044c, \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438, \u0418\u041d\u041d. \u0414\u0430\u043b\u0435\u0435 \u0432\u0440\u0443\u0447\u043d\u0443\u044e \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u043f\u043e\u043b\u044f: \u0434\u0430\u0442\u0430 \u0438\u0441\u0442\u0435\u0447\u0435\u043d\u0438\u044f \u0434\u043e\u0432\u0435\u0440\u0435\u043d\u043d\u043e\u0441\u0442\u0438, \u043d\u043e\u043c\u0435\u0440 \u0434\u043e\u0432\u0435\u0440\u0435\u043d\u043d\u043e\u0441\u0442\u0438, \u0424\u0418\u041e \u0438 \u043f\u043e\u0447\u0442\u0430 \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u0437\u0430 \u043a\u043e\u043d\u0442\u0440\u0430\u0433\u0435\u043d\u0442\u0430, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0424\u0418\u041e \u0438 \u043f\u043e\u0447\u0442\u0430 \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044f \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e. <\/p>\n<p>2.\u00a0\u0420\u0435\u0435\u0441\u0442\u0440 \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u043d\u043d\u044b\u0445 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432, \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0435\u0449\u0435 \u043d\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u043b\u0441\u044f \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u043e\u0431\u043e\u0440\u043e\u0442. \u042d\u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0447\u0442\u043e \u0431\u044b \u043d\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 \u043d\u0430 \u0431\u043e\u043b\u044c\u0448\u0438\u0435 \u0441\u0440\u043e\u043a\u0438 \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432. (\u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u044e \u0441\u043a\u0440\u0438\u043f\u0442, \u0447\u0438\u0442\u0430\u044e\u0449\u0438\u0439 \u0432\u0447\u0435\u0440\u0430\u0448\u043d\u044e\u044e \u0434\u0430\u0442\u0443) \u0435\u0441\u043b\u0438 \u043d\u0443\u0436\u0435\u043d \u0434\u0440\u0443\u0433\u043e\u0439 \u043f\u0435\u0440\u0438\u043e\u0434 \u2014 \u044d\u0442\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 \u0441\u043a\u0440\u0438\u043f\u0442\u0430.\u00a0 \u0420\u0435\u0435\u0441\u0442\u0440 \u043d\u0435\u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u044b\u0445 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0445\u0440\u0430\u043d\u0438\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u0432\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f. \u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430 \u0438 \u0435\u0433\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435. <\/p>\n<p>\u0414\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438  \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b API \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0421\u0411\u0418\u0421 \u0438 \u0414\u0438\u0430\u0434\u043e\u043a. <\/p>\n<p>\u0412\u0435\u0441\u044c \u043a\u043e\u0434 \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u043d\u0430 PowerShell. <\/p>\n<p>\u041e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u0440\u0430\u0437\u043e\u0431\u044c\u044e \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0445 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432. <\/p>\n<h2>\u0421\u0411\u0418\u0421<\/h2>\n<p>1.\u00a0\u0421\u0430\u043c\u043e\u0435 \u043f\u0435\u0440\u0432\u043e\u0435 \u0447\u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u043f\u0440\u043e\u0439\u0442\u0438 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044e \u043d\u0430 \u0441\u0435\u0440\u0432\u0438\u0441\u0435. <\/p>\n<p>API \u0441\u0431\u0438\u0441\u0430 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0432\u0441\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 JSON \u0447\u0442\u043e \u0431\u044b \u043d\u0435 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u0430\u0441\u0441\u0438\u0432 \u0432 JSON \u00a0\u044f \u0441\u0440\u0430\u0437\u0443 \u043f\u0438\u0448\u0443 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 JSON.<\/p>\n<pre><code class=\"powershell\"> $url = \"https:\/\/online.sbis.ru\/auth\/service\/\" #\u041f\u0443\u0442\u044c \u0434\u043e \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u0432 API \u0421\u0411\u0418\u0421 $urlquery = \"https:\/\/online.sbis.ru\/service\/?srv=1\"    #\u0410\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044e \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u043c \u043f\u043e \u043b\u043e\u0433\u0438\u043d\u0443 \u0438 \u043f\u0430\u0440\u043e\u043b\u044e. $Body = '{     \"jsonrpc\":\"2.0\",     \"method\":\"\u0421\u0411\u0418\u0421.\u0410\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c\",     \"params\" :{        \"\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\":{           \"\u041b\u043e\u0433\u0438\u043d\":\"API_login\",           \"\u041f\u0430\u0440\u043e\u043b\u044c\":\" API_Password\"        }     },     \"id\":\"0\"  }' # \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u044d\u0442\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0442\u043e\u043a\u0435\u043d \u043e\u043d \u043d\u0443\u0436\u0435\u043d \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u043c \u0434\u043b\u044f \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0438\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432  $token = (Invoke-RestMethod -Method Post -ContentType \"application\/json-rpc;charset=utf-8\" -Uri $url -Body $Body).result    # \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u044d\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a \u0431\u0443\u0434\u0443\u0449\u0438\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432  $headers = @{     'X-SBISSessionID' = $token }  <\/code><\/pre>\n<p>2.\u00a0\u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0440\u0435\u0435\u0441\u0442\u0440 \u0434\u043e\u0432\u0435\u0440\u0435\u043d\u043d\u043e\u0441\u0442\u0435\u0439<\/p>\n<pre><code class=\"powershell\">$pathxlsx = \"E:\\Scripts\\ChekSign\\\u0414\u043e\u0432\u0435\u0440\u0435\u043d\u043d\u043e\u0441\u0442\u0438.xlsx\"  $dataexcel = Import-Excel -Path $pathxlsx <\/code><\/pre>\n<p>3. \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0440\u0435\u0435\u0441\u0442\u0440 \u0440\u0430\u043d\u0435\u0435 \u043d\u0435\u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u044b\u0445 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432, \u0435\u0441\u043b\u0438 \u0443 \u043d\u0438\u0445 \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u043e\u0441\u044c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043d\u0430 \u201c\u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043e\u201d \u0442\u043e \u043f\u0440\u043e\u0432\u0430\u043b\u0438\u0432\u0430\u0435\u043c\u0441\u044f \u0432\u0433\u043b\u0443\u0431\u044c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430, \u0432 \u043f\u0440\u043e\u0442\u0438\u0432\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0437\u0430\u043d\u043e\u0432\u043e \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u044d\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0440\u0435\u0435\u0441\u0442\u0440 \u043d\u0435\u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u044b\u0445 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 (\u0440\u0435\u0435\u0441\u0442\u0440 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043a\u0430\u0436\u0434\u044b\u0439 \u0437\u0430\u043f\u0443\u0441\u043a \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b, \u0447\u0442\u043e \u0431\u044b \u043d\u0435 \u0443\u0434\u0430\u043b\u044f\u0442\u044c \u043f\u043e\u0441\u0442\u0440\u043e\u0447\u043d\u043e \u0438\u0437 \u044d\u043a\u0441\u0435\u043b\u044f).<\/p>\n<p>\u0412\u043d\u0443\u0442\u0440\u0438 \u043f\u0430\u043a\u0435\u0442\u0430 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u043d\u0430\u0441 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u0435\u0442 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442 \u0441 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c \u201c\u0423\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u0435 \u043e \u043f\u0440\u0438\u0435\u043c\u0435\u201d. \u00a0\u0410 \u0447\u0442\u043e \u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0438\u043c\u0435\u043d\u043d\u043e \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u0442\u0430 (\u0442\u043e\u0433\u043e \u0447\u044c\u0435\u0439 \u044d\u0446\u043f \u0431\u044b\u043b \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442,\u00a0\u00a0 \u0430 \u043d\u0435 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u044b\u0445 \u043b\u0438\u0446) \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u0447\u043b\u0435\u043d\u044f\u0442\u044c \u0432\u043b\u043e\u0436\u0435\u043d\u0438\u0435\u00a0 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0441\u043b\u043e\u0432\u043e \u0442\u0438\u0442\u0443\u043b(\u0442\u0430\u043a\u0438\u0445 \u0432\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043c\u043d\u043e\u0433\u043e, \u043d\u043e \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0441\u0430\u043c\u043e\u0435 \u043f\u0435\u0440\u0432\u043e\u0435 \u0441 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u043c 0. <\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e \u043a\u0430\u043a \u0432\u044b\u0447\u043b\u0435\u043d\u0438\u043b\u0438 \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u0442\u0430 \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u0435\u043c \u0435\u0441\u0442\u044c \u043b\u0438 \u043e\u043d \u0432 \u043d\u0430\u0448\u0435\u043c \u0440\u0435\u0435\u0441\u0442\u0440\u0435 \u0434\u043e\u0432\u0435\u0440\u0435\u043d\u043d\u043e\u0441\u0442\u0435\u0439 \u0438 \u0435\u0441\u043b\u0438 \u043d\u0435\u0442, \u0442\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u043c\u0430\u0441\u0441\u0438\u0432\u044b, \u043f\u043e\u0437\u0436\u0435 \u044d\u0442\u0438 \u043c\u0430\u0441\u0441\u0438\u0432\u044b \u0431\u0443\u0434\u0443\u0442 \u0437\u0430\u043f\u0438\u0441\u0430\u043d\u044b \u0432 \u044d\u043a\u0441\u0435\u043b\u044c \u043e\u0431\u0440\u0430\u0442\u043d\u043e. <\/p>\n<p>\u0415\u0441\u043b\u0438 \u043a\u0440\u0430\u0442\u043a\u043e \u043d\u0443\u0436\u043d\u044b\u0439 \u043d\u0430\u043c \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0441\u044f \u043f\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c\u0443 \u043f\u0443\u0442\u0438: \u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\/\u0441\u043e\u0431\u044b\u0442\u0438\u0435(\u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u0435 \u043e \u043f\u0440\u0438\u0435\u043c\u0435)\/\u0432\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435:(\u041f\u0435\u0440\u0435\u0434\u0430\u0442\u043e\u0447\u043d\u044b\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442 (\u0442\u0438\u0442\u0443\u043b \u043f\u043e\u043a\u0443\u043f\u0430\u0442\u0435\u043b\u044f))\/\u041f\u043e\u0434\u043f\u0438\u0441\u044c\/\u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\/\u0424\u0418\u041e. \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u044d\u0442\u043e \u0447\u0435\u0440\u0435\u0437 \u043c\u0435\u0442\u043e\u0434 \u0421\u0411\u0418\u0421.\u041f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442<\/p>\n<pre><code class=\"powershell\">$urlnofinish=\"E:\\Scripts\\ChekSign\\nofinishsbis.xlsx\"   #\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043c\u0430\u0441\u0441\u0438\u0432\u044b \u043a\u0443\u0434\u0430 \u0431\u0443\u0434\u0435\u043c \u0437\u0430\u043d\u043e\u0441\u0438\u0442\u044c \u043d\u043e\u043c\u0435\u0440\u0430 \u0438 \u0441\u0442\u0430\u0442\u0443\u0441\u044b \u0442\u0435\u0445 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435 \u043f\u0440\u043e\u0448\u043b\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443, \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e.  $arr_nofinish_id = @() $arr_nofinish_status = @()  $isfile = Test-Path $urlnofinish #\u0435\u0441\u043b\u0438 \u0444\u0430\u0439\u043b \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u043c \u0438\u0437 \u043d\u0435\u0433\u043e \u0434\u0430\u043d\u043d\u044b\u0435. if ($isfile){ $nofinish = Import-Excel -Path $urlnofinish foreach ($nf in $nofinish){   $JsonBodyNoFinish =  '{    \"jsonrpc\": \"2.0\",    \"method\": \"\u0421\u0411\u0418\u0421.\u041f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\",    \"params\": {       \"\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\": {          \"\u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\": \"'+$nf.\u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440+'\",          \"\u0414\u043e\u043f\u041f\u043e\u043b\u044f\": \"\u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435\u041f\u043e\u043b\u044f\"       }    },    \"id\": 0 }'     $ArrNames =  Invoke-RestMethod -Method Post -ContentType \"application\/json-rpc;charset=utf-8\" -Uri $urlquery -Body $JsonBodyNoFinish -Headers $headers  $inb = $ArrNames.result.\u0421\u043e\u0431\u044b\u0442\u0438\u0435 $i=0  if (($ArrNames.result.\u0421\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435.\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 -ne \"\u0412\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043e \u0443\u0441\u043f\u0435\u0448\u043d\u043e\")  -and ($ArrNames.result.\u0421\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435.\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 -ne \"\u0412\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043e \u0441 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430\u043c\u0438\")) { $arr_nofinish_id += $ArrNames.result.\u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 $arr_nofinish_status += $ArrNames.result.\u0421\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435.\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 } else {  foreach ($in in $inb){  if ($in.\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 -eq \"\u0423\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u0435 \u043e \u043f\u0440\u0438\u0435\u043c\u0435\"){ $tin = $in.\u0412\u043b\u043e\u0436\u0435\u043d\u0438\u0435.\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 $i=0 foreach ($t in $tin){ if ($t.Contains(\"\u0442\u0438\u0442\u0443\u043b\")){  foreach ($excel in $dataexcel) { $in.\u0412\u043b\u043e\u0436\u0435\u043d\u0438\u0435.\u041f\u043e\u0434\u043f\u0438\u0441\u044c.\u0421\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442.\u0418\u041d\u041d[$i] $in.\u0412\u043b\u043e\u0436\u0435\u043d\u0438\u0435.\u041f\u043e\u0434\u043f\u0438\u0441\u044c.\u0421\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442.\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435[$i] $in.\u0412\u043b\u043e\u0436\u0435\u043d\u0438\u0435.\u041f\u043e\u0434\u043f\u0438\u0441\u044c.\u0421\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442.\u0424\u0418\u041e[$i] $in.\u0412\u043b\u043e\u0436\u0435\u043d\u0438\u0435.\u041f\u043e\u0434\u043f\u0438\u0441\u044c.\u0421\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442.\u0414\u043e\u043b\u0436\u043d\u043e\u0441\u0442\u044c[$i]   if ($excel.\u0424\u0418\u041e -eq $in.\u0412\u043b\u043e\u0436\u0435\u043d\u0438\u0435.\u041f\u043e\u0434\u043f\u0438\u0441\u044c.\u0421\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442.\u0424\u0418\u041e[$i]) { $f = 1 if ($excel.\u0414\u0430\u0442\u0430 -eq $null){  } else { if($excel.\u0414\u043e\u0432\u0435\u0440\u0435\u043d\u043d\u043e\u0441\u0442\u044c -ne \"\u0423\u0441\u0442\u0430\u0432\"){ if ($date -gt $excel.\u0414\u0430\u0442\u0430_\u0438\u0441\u0442\u0435\u0447\u0435\u043d\u0438\u044f_\u0434\u043e\u0432\u0435\u0440\u0435\u043d\u043d\u043e\u0441\u0442\u0438){   if($arr_data_name -notcontains $in.\u0412\u043b\u043e\u0436\u0435\u043d\u0438\u0435.\u041f\u043e\u0434\u043f\u0438\u0441\u044c.\u0421\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442.\u0424\u0418\u041e[$i]) { $arr_data_name +=($in.\u0412\u043b\u043e\u0436\u0435\u043d\u0438\u0435.\u041f\u043e\u0434\u043f\u0438\u0441\u044c.\u0421\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442.\u0424\u0418\u041e[$i]) $arr_data_company +=($in.\u0412\u043b\u043e\u0436\u0435\u043d\u0438\u0435.\u041f\u043e\u0434\u043f\u0438\u0441\u044c.\u0421\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442.\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435[$i]) $arr_data_master +=($excel.\u041e\u0442\u0432\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439) $arr_data_email+=($excel.Email) $arr_data_position +=($excel.\u0414\u043e\u043b\u0436\u043d\u043e\u0441\u0442\u044c)  } } } } }  }  if ($f -eq 0 ){    if ( $arr_name -notcontains $in.\u0412\u043b\u043e\u0436\u0435\u043d\u0438\u0435.\u041f\u043e\u0434\u043f\u0438\u0441\u044c.\u0421\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442.\u0424\u0418\u041e[$i] ) {  $arr_name+=($in.\u0412\u043b\u043e\u0436\u0435\u043d\u0438\u0435.\u041f\u043e\u0434\u043f\u0438\u0441\u044c.\u0421\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442.\u0424\u0418\u041e[$i]) if ($in.\u0412\u043b\u043e\u0436\u0435\u043d\u0438\u0435.\u041f\u043e\u0434\u043f\u0438\u0441\u044c.\u0421\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442.\u0418\u041d\u041d[$i] -ne $null){ if ($in.\u0412\u043b\u043e\u0436\u0435\u043d\u0438\u0435.\u041f\u043e\u0434\u043f\u0438\u0441\u044c.\u0421\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442.\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435[$i] -ne \"\") { $arr_company+=($in.\u0412\u043b\u043e\u0436\u0435\u043d\u0438\u0435.\u041f\u043e\u0434\u043f\u0438\u0441\u044c.\u0421\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442.\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435[$i]) $arr_position+=($in.\u0412\u043b\u043e\u0436\u0435\u043d\u0438\u0435.\u041f\u043e\u0434\u043f\u0438\u0441\u044c.\u0421\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442.\u0414\u043e\u043b\u0436\u043d\u043e\u0441\u0442\u044c[$i]) }  if ($in.\u0412\u043b\u043e\u0436\u0435\u043d\u0438\u0435.\u041f\u043e\u0434\u043f\u0438\u0441\u044c.\u0421\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442.\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435[$i] -eq \"\"){ $arr_company+= ($in.\u0412\u043b\u043e\u0436\u0435\u043d\u0438\u0435.\u041f\u043e\u0434\u043f\u0438\u0441\u044c.\u0421\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442.\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435[$i]) $arr_position+=($in.\u0412\u043b\u043e\u0436\u0435\u043d\u0438\u0435.\u041f\u043e\u0434\u043f\u0438\u0441\u044c.\u0421\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442.\u0414\u043e\u043b\u0436\u043d\u043e\u0441\u0442\u044c[$i]) }  } else { $arr_company+=($in.\u0412\u043b\u043e\u0436\u0435\u043d\u0438\u0435.\u041f\u043e\u0434\u043f\u0438\u0441\u044c.\u0421\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442.\u0424\u0418\u041e[$i]) $arr_inn+=($in.\u0412\u043b\u043e\u0436\u0435\u043d\u0438\u0435.\u041f\u043e\u0434\u043f\u0438\u0441\u044c.\u0421\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442.\u0418\u041d\u041d[$i]) }  }  }  } $i++ } } }   }  else{ $Null | Export-Excel -Path $urlnofinish  -WorksheetName \"\u041b\u0438\u0441\u04421\"   -AutoSize   $book = Open-ExcelPackage -Path $urlnofinish $worksheet = $book.Workbook.Worksheets['\u041b\u0438\u0441\u04421']  $worksheet.Cells[1,1].Value = \"\u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\" $worksheet.Cells[1,2].Value = \"\u0421\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435\"  Close-ExcelPackage $book <\/code><\/pre>\n<p>4. \u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e \u043a\u0430\u043a \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u043b\u0438 \u0441\u0442\u0430\u0440\u044b\u0435 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u044b \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a \u0447\u0442\u0435\u043d\u0438\u044e \u043d\u043e\u0432\u044b\u0445. <\/p>\n<p>\u0421\u043f\u0435\u0440\u0432\u0430 \u043f\u043e\u043b\u0430\u0435\u043c \u0441\u043f\u0438\u0441\u043e\u043a \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432, \u0430 \u0434\u0430\u043b\u0435\u0435 \u043e\u0431\u0440\u0430\u0449\u0430\u0435\u043c\u0441\u044f \u043a \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0443 \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e. <\/p>\n<p>\u0421\u0440\u0430\u0437\u0443 \u0445\u043e\u0447\u0443 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c \u0447\u0442\u043e \u043f\u0440\u0438 \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0438 \u043a \u0441\u043f\u0438\u0441\u043a\u0443 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0447\u0442\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u043e\u0441\u0442\u0440\u0430\u043d\u0438\u0447\u043d\u043e, \u0438 \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 \u0432\u043b\u0430\u0437\u0438\u0442 \u043d\u0435 \u0431\u043e\u043b\u0435\u0435 200 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432.<\/p>\n<p>\u041f\u043e-\u044d\u0442\u043e\u043c\u0443 \u0447\u0438\u0442\u0430\u0435\u043c \u043f\u043e\u0441\u0442\u0440\u0430\u043d\u0438\u0447\u043d\u043e \u0438 \u0437\u0430\u043d\u043e\u0441\u0438\u043c \u0432\u0441\u0435 \u0432 \u043c\u0430\u0441\u0441\u0438\u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432.\u00a0 <\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e \u043a\u0430\u043a \u0432\u0441\u0435 \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u043b\u0438 \u0437\u0430\u043d\u043e\u0441\u0438\u043c \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u0442\u043e\u0432 \u0432 \u0440\u0435\u0435\u0441\u0442\u0440, \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u043d\u0435 \u0438\u0441\u0442\u0435\u043a\u043b\u0430 \u043b\u0438 \u0438\u0445 \u0434\u043e\u0432\u0435\u0440\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u0438 \u043e\u043f\u043e\u0432\u0435\u0449\u0430\u0435\u043c \u043e\u0431 \u044d\u0442\u043e\u043c \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u043b\u0438\u0446 \u0438 \u0438\u0445 \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u0435\u0439. \u0410 \u0442\u0430\u043a \u0436\u0435 \u043d\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u044b\u0435 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u044b \u0437\u0430\u043d\u043e\u0441\u0438\u043c \u0432 \u0440\u0435\u0435\u0441\u0442\u0440 \u043d\u0435\u043e\u043a\u043e\u043d\u0447\u0435\u043d\u043d\u044b\u0445. <\/p>\n<p>\u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 write \u2013 host $msg \u00a0\u044d\u0442\u043e \u043a\u0430\u043a \u0440\u0430\u0437 \u043e\u043f\u043e\u0432\u0435\u0449\u0435\u043d\u0438\u044f \u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e $msg \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0432 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0443 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u043f\u043e\u0447\u0442\u044b (\u0441\u043c \u043d\u0438\u0436\u0435) <\/p>\n<p>\u0422\u0430\u043a \u0436\u0435 \u0445\u043e\u0447\u0443 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c \u0435\u0441\u043b\u0438 \u0434\u043e\u043b\u0436\u043d\u043e\u0441\u0442\u044c \u0443 \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u0442\u0430 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440, \u0433\u0435\u043d \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440, \u043f\u0440\u0435\u0437\u0438\u0434\u0435\u043d\u0442 \u0442\u043e \u043d\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0434\u043e\u0432\u0435\u0440\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u0438\u0431\u043e \u043e\u043d\u0430 \u043d\u0435 \u043d\u0443\u0436\u043d\u0430. <\/p>\n<pre><code class=\"powershell\">$dStart = (((date).Day - 1).ToString() + \".\" + ((date).Month).ToString() + \".\" +((date).Year).ToString())   $dEnd = (((date).Day - 1).ToString() + \".\" + ((date).Month).ToString() + \".\" +((date).Year).ToString())   $flag = 0  $fl =0  $arr_name = @() $arr_company = @() $arr_inn = @() $arr_kpp = @() $arr_position = @()  $arr_data_name = @() $arr_data_company = @() $arr_data_master = @() $arr_data_email = @() $arr_data_position = @()  $s = $dStart $po= $dEnd     $JsonBodyQuery2 = '{     \"jsonrpc\": \"2.0\",    \"method\": \"\u0421\u0411\u0418\u0421.\u0421\u043f\u0438\u0441\u043e\u043a\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432\",    \"params\": {       \"\u0424\u0438\u043b\u044c\u0442\u0440\": {          \"\u0414\u0430\u0442\u0430\u0421\": \"'+$s+'\",  \"\u0414\u0430\u0442\u0430\u041f\u043e\": \"'+$po+'\",  \"\u041d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435\": \"\u0418\u0441\u0445\u043e\u0434\u044f\u0449\u0438\u0439\",          \"\u0422\u0438\u043f\": \"\u0414\u043e\u043a\u041e\u0442\u0433\u0440\u0418\u0441\u0445\",  \"\u041d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u044f\": {         \"\u0420\u0430\u0437\u043c\u0435\u0440\u0421\u0442\u0440\u0430\u043d\u0438\u0446\u044b\": \"'+$itempagecount+'\",         \"\u0421\u0442\u0440\u0430\u043d\u0438\u0446\u0430\" : \"'+$page+'\" }       }    },    \"id\": 0   }'   $i=0    #\u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u043f\u0438\u0441\u043e\u043a \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0438 \u043e\u0431\u0440\u0449\u0430\u0435\u043c\u0441\u044f \u043a \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u043f\u043e \u0430\u0439\u0434\u0438  $Docs =  Invoke-RestMethod -Method Post -ContentType \"application\/json-rpc;charset=utf-8\" -Uri $urlquery -Body $JsonBodyquery2 -Headers $headers   while ($flag -eq 0) {   $Ids = $Docs.result.\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442    foreach ($id in $Ids) {  $JsonBodyQuery4 =  '{    \"jsonrpc\": \"2.0\",    \"method\": \"\u0421\u0411\u0418\u0421.\u041f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\",    \"params\": {       \"\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\": {          \"\u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\": \"'+ $id.\u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440+ '\",          \"\u0414\u043e\u043f\u041f\u043e\u043b\u044f\": \"\u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435\u041f\u043e\u043b\u044f\"       }    },    \"id\": 0 }' #\u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u043f\u043e\u0434\u043f\u0438\u0441\u0438 if (($id.\u0421\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435.\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 -ne \"\u0412\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043e \u0443\u0441\u043f\u0435\u0448\u043d\u043e\")  -and ($id.\u0421\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435.\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 -ne \"\u0412\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043e \u0441 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430\u043c\u0438\")) { if ($arr_nofinish_id -notcontains $id.\u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440){ $arr_nofinish_id += $id.\u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 $arr_nofinish_status += $id.\u0421\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435.\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 } }  else {  $ArrNames =  Invoke-RestMethod -Method Post -ContentType \"application\/json-rpc;charset=utf-8\" -Uri $urlquery -Body $JsonBodyquery4 -Headers $headers  $inboxes =  $ArrNames.result.\u0421\u043e\u0431\u044b\u0442\u0438\u0435  foreach ( $inbox in $inboxes){   if ($inbox.\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 -eq \"\u0423\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u0435 \u043e \u043f\u0440\u0438\u0435\u043c\u0435\"   ){ $tinboxes = $inbox.\u0412\u043b\u043e\u0436\u0435\u043d\u0438\u0435.\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 $i=0  foreach ($tinbox in $tinboxes ){ if ($tinbox.Contains(\"\u0442\u0438\u0442\u0443\u043b\")){   if ($inbox.\u0412\u043b\u043e\u0436\u0435\u043d\u0438\u0435.\u041f\u043e\u0434\u043f\u0438\u0441\u044c.\u0421\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442.\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435.Count -eq 1) {  $invlpodsertnaz = $inbox.\u0412\u043b\u043e\u0436\u0435\u043d\u0438\u0435.\u041f\u043e\u0434\u043f\u0438\u0441\u044c.\u0421\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442.\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 $invlpodsertfio = $inbox.\u0412\u043b\u043e\u0436\u0435\u043d\u0438\u0435.\u041f\u043e\u0434\u043f\u0438\u0441\u044c.\u0421\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442.\u0424\u0418\u041e $invlpodsertdol = $inbox.\u0412\u043b\u043e\u0436\u0435\u043d\u0438\u0435.\u041f\u043e\u0434\u043f\u0438\u0441\u044c.\u0421\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442.\u0414\u043e\u043b\u0436\u043d\u043e\u0441\u0442\u044c  } else{ $invlpodsertnaz = $inbox.\u0412\u043b\u043e\u0436\u0435\u043d\u0438\u0435.\u041f\u043e\u0434\u043f\u0438\u0441\u044c.\u0421\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442.\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435[$i] $invlpodsertfio = $inbox.\u0412\u043b\u043e\u0436\u0435\u043d\u0438\u0435.\u041f\u043e\u0434\u043f\u0438\u0441\u044c.\u0421\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442.\u0424\u0418\u041e[$i] $invlpodsertdol = $inbox.\u0412\u043b\u043e\u0436\u0435\u043d\u0438\u0435.\u041f\u043e\u0434\u043f\u0438\u0441\u044c.\u0421\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442.\u0414\u043e\u043b\u0436\u043d\u043e\u0441\u0442\u044c[$i] } $Namestring = ($invlpodsertnaz).ToUpper() if ($invlpodsertnaz -ne '\u0421\u041e\u0411\u0421\u0422\u0412\u0415\u041d\u041d\u0410\u042f \u0424\u0418\u0420\u041c\u0410\u2019) { #\u0442\u0443\u0442 \u0443\u0431\u0438\u0440\u0430\u0435\u043c \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u0443\u044e \u0444\u0438\u0440\u043c\u0443 \u0447\u0442\u043e \u0431\u044b # \u043d\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u0441\u0432\u043e\u0438\u0445 \u043f\u043e\u0434\u043f\u0441\u0438\u0430\u043d\u0442\u043e\u0432(\u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0441\u0447\u0438\u0442\u0430\u0435\u043c \u0447\u0442\u043e \u0443 \u043d\u0438\u0445 \u0435\u0441\u0442 \u0434\u043e\u0432\u0435\u0440\u0435\u043d\u043d\u043e\u0441\u0442\u0438 $f = 0  foreach ($excel in $dataexcel) {  if ($excel.\u0424\u0418\u041e -eq $invlpodsertfio) { $f = 1 if ($excel.\u0414\u0430\u0442\u0430 -eq $null){  } else { if($excel.\u0414\u043e\u0432\u0435\u0440\u0435\u043d\u043d\u043e\u0441\u0442\u044c -ne \"\u0423\u0441\u0442\u0430\u0432\"){ if ($date -gt $excel.\u0414\u0430\u0442\u0430_\u0438\u0441\u0442\u0435\u0447\u0435\u043d\u0438\u044f_\u0434\u043e\u0432\u0435\u0440\u0435\u043d\u043d\u043e\u0441\u0442\u0438){   if($arr_data_name -notcontains $invlpodsertfio) { $arr_data_name +=($invlpodsertfio) $arr_data_company +=($invlpodsertnaz) $arr_data_master +=($excel.\u041e\u0442\u0432\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439) $arr_data_email+=($excel.Email) $arr_data_position +=($excel.\u0414\u043e\u043b\u0436\u043d\u043e\u0441\u0442\u044c)  }  } } } }}  if ($f -eq 0 ){    if ( $arr_name -notcontains $invlpodsertfio) {  $arr_name+=($invlpodsertfio) if ($id.\u041a\u043e\u043d\u0442\u0440\u0430\u0433\u0435\u043d\u0442.\u0421\u0432\u042e\u041b.\u0418\u041d\u041d -ne $null){ if ($invlpodsertnaz -ne \"\") { $arr_company+=($invlpodsertnaz) $arr_position+=($invlpodsertdol) } if ($invlpodsertnaz -eq \"\"){ $arr_company+= ($id.\u041a\u043e\u043d\u0442\u0440\u0430\u0433\u0435\u043d\u0442.\u0421\u0432\u042e\u041b.\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435) $arr_position+=($invlpodsertdol) } $arr_inn+=($id.\u041a\u043e\u043d\u0442\u0440\u0430\u0433\u0435\u043d\u0442.\u0421\u0432\u042e\u041b.\u0418\u041d\u041d) } else { $arr_company+=($id.\u041a\u043e\u043d\u0442\u0440\u0430\u0433\u0435\u043d\u0442.\u0421\u0432\u0424\u041b.\u0424\u0430\u043c\u0438\u043b\u0438\u044f + \" \"+ $id.\u041a\u043e\u043d\u0442\u0440\u0430\u0433\u0435\u043d\u0442.\u0421\u0432\u0424\u041b.\u0418\u043c\u044f + \" \" + $id.\u041a\u043e\u043d\u0442\u0440\u0430\u0433\u0435\u043d\u0442.\u0421\u0432\u0424\u041b.\u041e\u0442\u0447\u0435\u0441\u0442\u0432\u043e ) $arr_inn+=($id.\u041a\u043e\u043d\u0442\u0440\u0430\u0433\u0435\u043d\u0442.\u0421\u0432\u0424\u041b.\u0418\u041d\u041d) }  }   }   }  } $i++ } }  }       } }     $page+=1  $JsonBodyQuery2 = '{     \"jsonrpc\": \"2.0\",    \"method\": \"\u0421\u0411\u0418\u0421.\u0421\u043f\u0438\u0441\u043e\u043a\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432\",    \"params\": {       \"\u0424\u0438\u043b\u044c\u0442\u0440\": {          \"\u0414\u0430\u0442\u0430\u0421\": \"'+$s+'\",  \"\u0414\u0430\u0442\u0430\u041f\u043e\": \"'+$po+'\",  \"\u041d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435\": \"\u0418\u0441\u0445\u043e\u0434\u044f\u0449\u0438\u0439\",          \"\u0422\u0438\u043f\": \"\u0414\u043e\u043a\u041e\u0442\u0433\u0440\u0418\u0441\u0445\",  \"\u041d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u044f\": {         \"\u0420\u0430\u0437\u043c\u0435\u0440\u0421\u0442\u0440\u0430\u043d\u0438\u0446\u044b\": \"'+$itempagecount+'\",         \"\u0421\u0442\u0440\u0430\u043d\u0438\u0446\u0430\" : \"'+$page+'\" }       }    },    \"id\": 0   }'  $Docs =  Invoke-RestMethod -Method Post -ContentType \"application\/json-rpc;charset=utf-8\" -Uri $urlquery -Body $JsonBodyquery2 -Headers $headers  if ($Docs.result.\u041d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u044f.\u0415\u0441\u0442\u044c\u0415\u0449\u0435 -ne \"\u0414\u0430\") {$fl+=1} if ($fl -gt 1) {$flag=1}   }   Remove-Item -Path $urlnofinish $Null | Export-Excel -Path $urlnofinish  -WorksheetName \"\u041b\u0438\u0441\u04421\"   -AutoSize    $book = Open-ExcelPackage -Path $urlnofinish $worksheet = $book.Workbook.Worksheets['\u041b\u0438\u0441\u04421']   $worksheet.Cells[1,1].Value = \"\u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\" $worksheet.Cells[1,2].Value = \"\u0421\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435\" $i=0  for ($i=0; $i -lt $arr_nofinish_id.count; $i++ ){ $worksheet.Cells[($i+2),1].Value = $arr_nofinish_id[$i] $worksheet.Cells[($i+2),2].Value = $arr_nofinish_status[$i]   } Close-ExcelPackage $book   if ($arr_name -ne $null){  $book = Open-ExcelPackage -Path $pathxlsx $worksheet = $book.Workbook.Worksheets['\u041b\u0438\u0441\u04421'] $i = 0  $j = 0   $msg=\"\u0414\u043e\u0432\u0435\u0440\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u044b, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u0434\u043b\u044f:`n \" for ($i = 0; $i -lt ($arr_name.Count); $i++ ){ $worksheet.Cells[($dataexcel.Count+2+$i),1].Value = $arr_name[$i] $worksheet.Cells[($dataexcel.Count+2+$i),2].Value = $arr_company[$i] $worksheet.Cells[($dataexcel.Count+2+$i),3].Value = $arr_position[$i] $worksheet.Cells[($dataexcel.Count+2+$i),4].Value = $arr_inn[$i] $msg+=$arr_name[$i]+ \" \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u044f \" + $arr_company[$i] +\" \u0434\u043e\u043b\u0436\u043d\u043e\u0441\u0442\u044c \"+ $arr_position[$i] +\" \u0418\u041d\u041d \" + $arr_inn[$i]  +\"`n\" } Close-ExcelPackage $book   Write-Host $msg }   $i = 0  $j = 0   $arr_unic_data_email =@()  for($i=0;$i -le ($arr_data_email.Count-1); $i++){ if ($arr_unic_data_email -notcontains $arr_data_email[$i] ){ $arr_unic_data_email += ($arr_data_email[$i]) } }    $msg =\"\" for($j=0;$j -le ($arr_unic_data_email.Count-1); $j++){ $msg =\"\u0414\u0430\u0442\u0430 \u0434\u043e\u0432\u0435\u0440\u0435\u043d\u043d\u043e\u0441\u0442\u0435\u0439 \u0438\u0441\u0442\u0435\u043a\u043b\u0430 \u0434\u043b\u044f:`n\" for($i=0;$i -le $arr_data_name.Count; $i++){ if ($arr_unic_data_email[$j] -eq $arr_data_email[$i]) { $msg += $arr_data_name[$i] +\" \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u044f \"+$arr_data_company[$i] +\" \u0434\u043e\u043b\u0436\u043d\u043e\u0441\u0442\u044c \" + $arr_data_position[$i] +\" \u041e\u0442\u0432\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \"+ $arr_data_master[$i] +\"`n\" } } Write-Host \"\u041f\u0438\u0441\u044c\u043c\u043e \u0434\u043b\u044f\"$arr_unic_data_email[$j]\"`n\"$msg }  $dataexcel = Import-Excel -Path $pathxlsx $i=0 $book = Open-ExcelPackage -Path $pathxlsx $worksheet = $book.Workbook.Worksheets['\u041b\u0438\u0441\u04421'] for ($i=2; $i -lt $dataexcel.Count; $i++){  if ($worksheet.Cells[$i,3].Value -ne \"\"){ $str = (($worksheet.Cells[$i,3].Value)).ToUpper() if (($str -eq \"\u0413\u0415\u041d\u0415\u0420\u0410\u041b\u042c\u041d\u042b\u0419 \u0414\u0418\u0420\u0415\u041a\u0422\u041e\u0420\") -or ($str -eq \"\u041f\u0420\u0415\u0417\u0418\u0414\u0415\u041d\u0422\") -or ($str -eq \"\u0414\u0418\u0420\u0415\u041a\u0422\u041e\u0420\")){ $worksheet.Cells[$i,5].Value = \"\u0423\u0441\u0442\u0430\u0432\"  } } }  Close-ExcelPackage $book     Invoke-RestMethod -Method Post -ContentType \"application\/json-rpc;charset=utf-8\" -Uri $url -Body $JsonBody_close -Headers $headers  <\/code><\/pre>\n<p>5.\u00a0\u041c\u043e\u0434\u0443\u043b\u044c \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u043f\u043e\u0447\u0442\u044b <\/p>\n<pre><code class=\"powershell\">function SendMailToUser($To,$message) { $From=\"notifier@mydomain.ru\" $Subject=\"\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0432\" $Body=$message $Password=\"Pa$$w0rd\" $SecPassword=New-Object -TypeName System.Security.SecureString $Password.ToCharArray() | foreach {$SecPassword.AppendChar($_)} $Credintial=New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $From,$SecPassword $smtpServer=\"mail.mydomain.ru\" $SMTPport=\"25\" $encoding = [System.Text.Encoding]::UTF8 Send-MailMessage -From $From -To $To -Subject $Subject -BodyAsHtml -Body $Body -Credential $Credintial -SmtpServer $smtpServer -Port $SMTPport -Priority \"High\"  -Encoding $encoding  -ErrorAction Stop }  <\/code><\/pre>\n<p>\u041f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u0434 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b. \u0421\u0440\u0430\u0437\u0443 \u0441\u043a\u0430\u0436\u0443, \u0447\u0442\u043e \u044f \u043d\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442 \u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0433\u0434\u0435-\u0442\u043e \u043a\u043e\u0434 \u043d\u0435 \u0438\u0434\u0435\u0430\u043b\u044c\u043d\u044b\u0439, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0435\u0441\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0438 \u044d\u0442\u043e \u043e\u0434\u0438\u043d \u0438\u0437 \u043f\u0435\u0440\u0432\u044b\u0445 \u0440\u0435\u043b\u0438\u0437\u043e\u0432. \u0414\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c excel \u0444\u0430\u0439\u043b \u0441 \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u0435\u043c \u0432 \u043f\u0435\u0440\u0432\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u043e\u0432 \u0441\u0442\u043e\u043b\u0431\u0446\u043e\u0432. <\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/e6e\/3b5\/7d6\/e6e3b57d66545a8fe18ac16482e6f2ac.png\" width=\"1564\" height=\"303\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/e6e\/3b5\/7d6\/e6e3b57d66545a8fe18ac16482e6f2ac.png\"\/><\/figure>\n<pre><code class=\"powershell\">function ChekSbis{ [CmdletBinding()]    param(    $dStart = (((date).Day - 1).ToString() + \".\" + ((date).Month).ToString() + \".\" +((date).Year).ToString()),      $dEnd = (((date).Day - 1).ToString() + \".\" + ((date).Month).ToString() + \".\" +((date).Year).ToString())      ) $url = \"https:\/\/online.sbis.ru\/auth\/service\/\" $urlquery = \"https:\/\/online.sbis.ru\/service\/?srv=1\" $pathxlsx = \"E:\\Scripts\\ChekSign\\\u0414\u043e\u0432\u0435\u0440\u0435\u043d\u043d\u043e\u0441\u0442\u0438.xlsx\" $s = $dStart $po= $dEnd  $dataexcel = Import-Excel -Path $pathxlsx $flag = 0  $fl =0  $arr_name = @() $arr_company = @() $arr_inn = @() $arr_kpp = @() $arr_position = @()  $arr_data_name = @() $arr_data_company = @() $arr_data_master = @() $arr_data_email = @() $arr_data_position = @()  #\u0422\u0435\u043b\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0434\u043b\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043a \u0430\u043f\u0438 \u0441\u0431\u0438\u0441\u0430  $Body = '{     \"jsonrpc\":\"2.0\",     \"method\":\"\u0421\u0411\u0418\u0421.\u0410\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c\",     \"params\" :{        \"\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\":{           \"\u041b\u043e\u0433\u0438\u043d\":\"API_login\",           \"\u041f\u0430\u0440\u043e\u043b\u044c\":\"API_Password\"        }     },     \"id\":\"0\"  }' $JsonBody = $Body   $token = (Invoke-RestMethod -Method Post -ContentType \"application\/json-rpc;charset=utf-8\" -Uri $url -Body $JsonBody).result $Body_close = '{     \"jsonrpc\":\"2.0\",     \"method\":\"\u0421\u0411\u0418\u0421.\u0412\u044b\u0445\u043e\u0434\",     \"params\" :{},     \"id\":\"0\"  }'  $JsonBody_close = $Body_close  $headers = @{     'X-SBISSessionID' = $token }   $date = date  $page = 0  $itempagecount = 200 $urlnofinish=\"E:\\Scripts\\ChekSign\\nofinishsbis.xlsx\"  $arr_nofinish_id = @() $arr_nofinish_status = @() $arr_data_nofinish_id = @() $arr_data_nofinish_status = @() $isfile = Test-Path $urlnofinish #\u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0440\u0430\u043d\u0435\u0435 \u043d\u0435 \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0445 \u0438\u0434\u0435\u043d\u0442\u0435\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u043e\u0432  if ($isfile){ $nofinish = Import-Excel -Path $urlnofinish foreach ($nf in $nofinish){   $JsonBodyNoFinish =  '{    \"jsonrpc\": \"2.0\",    \"method\": \"\u0421\u0411\u0418\u0421.\u041f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\",    \"params\": {       \"\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\": {          \"\u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\": \"'+$nf.\u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440+'\",          \"\u0414\u043e\u043f\u041f\u043e\u043b\u044f\": \"\u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435\u041f\u043e\u043b\u044f\"       }    },    \"id\": 0 }'    $ArrNames =  Invoke-RestMethod -Method Post -ContentType \"application\/json-rpc;charset=utf-8\" -Uri $urlquery -Body $JsonBodyNoFinish -Headers $headers  $inb = $ArrNames.result.\u0421\u043e\u0431\u044b\u0442\u0438\u0435 $i=0  if (($ArrNames.result.\u0421\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435.\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 -ne \"\u0412\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043e \u0443\u0441\u043f\u0435\u0448\u043d\u043e\")  -and ($ArrNames.result.\u0421\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435.\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 -ne \"\u0412\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043e \u0441 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430\u043c\u0438\")) { $arr_nofinish_id += $ArrNames.result.\u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 $arr_nofinish_status += $ArrNames.result.\u0421\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435.\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 } else {  foreach ($in in $inb){  if ($in.\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 -eq \"\u0423\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u0435 \u043e \u043f\u0440\u0438\u0435\u043c\u0435\"){ $tin = $in.\u0412\u043b\u043e\u0436\u0435\u043d\u0438\u0435.\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 $i=0 foreach ($t in $tin){ if ($t.Contains(\"\u0442\u0438\u0442\u0443\u043b\")){  foreach ($excel in $dataexcel) { $in.\u0412\u043b\u043e\u0436\u0435\u043d\u0438\u0435.\u041f\u043e\u0434\u043f\u0438\u0441\u044c.\u0421\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442.\u0418\u041d\u041d[$i] $in.\u0412\u043b\u043e\u0436\u0435\u043d\u0438\u0435.\u041f\u043e\u0434\u043f\u0438\u0441\u044c.\u0421\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442.\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435[$i] $in.\u0412\u043b\u043e\u0436\u0435\u043d\u0438\u0435.\u041f\u043e\u0434\u043f\u0438\u0441\u044c.\u0421\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442.\u0424\u0418\u041e[$i] $in.\u0412\u043b\u043e\u0436\u0435\u043d\u0438\u0435.\u041f\u043e\u0434\u043f\u0438\u0441\u044c.\u0421\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442.\u0414\u043e\u043b\u0436\u043d\u043e\u0441\u0442\u044c[$i]   if ($excel.\u0424\u0418\u041e -eq $in.\u0412\u043b\u043e\u0436\u0435\u043d\u0438\u0435.\u041f\u043e\u0434\u043f\u0438\u0441\u044c.\u0421\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442.\u0424\u0418\u041e[$i]) { $f = 1 if ($excel.\u0414\u0430\u0442\u0430 -eq $null){  } else { if($excel.\u0414\u043e\u0432\u0435\u0440\u0435\u043d\u043d\u043e\u0441\u0442\u044c -ne \"\u0423\u0441\u0442\u0430\u0432\"){ if ($date -gt $excel.\u0414\u0430\u0442\u0430_\u0438\u0441\u0442\u0435\u0447\u0435\u043d\u0438\u044f_\u0434\u043e\u0432\u0435\u0440\u0435\u043d\u043d\u043e\u0441\u0442\u0438){   if($arr_data_name -notcontains $in.\u0412\u043b\u043e\u0436\u0435\u043d\u0438\u0435.\u041f\u043e\u0434\u043f\u0438\u0441\u044c.\u0421\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442.\u0424\u0418\u041e[$i]) { $arr_data_name +=($in.\u0412\u043b\u043e\u0436\u0435\u043d\u0438\u0435.\u041f\u043e\u0434\u043f\u0438\u0441\u044c.\u0421\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442.\u0424\u0418\u041e[$i]) $arr_data_company +=($in.\u0412\u043b\u043e\u0436\u0435\u043d\u0438\u0435.\u041f\u043e\u0434\u043f\u0438\u0441\u044c.\u0421\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442.\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435[$i]) $arr_data_master +=($excel.\u041e\u0442\u0432\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439) $arr_data_email+=($excel.Email) $arr_data_position +=($excel.\u0414\u043e\u043b\u0436\u043d\u043e\u0441\u0442\u044c)  }    } } } }  }  if ($f -eq 0 ){     if ( $arr_name -notcontains $in.\u0412\u043b\u043e\u0436\u0435\u043d\u0438\u0435.\u041f\u043e\u0434\u043f\u0438\u0441\u044c.\u0421\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442.\u0424\u0418\u041e[$i] ) {  $arr_name+=($in.\u0412\u043b\u043e\u0436\u0435\u043d\u0438\u0435.\u041f\u043e\u0434\u043f\u0438\u0441\u044c.\u0421\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442.\u0424\u0418\u041e[$i]) if ($in.\u0412\u043b\u043e\u0436\u0435\u043d\u0438\u0435.\u041f\u043e\u0434\u043f\u0438\u0441\u044c.\u0421\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442.\u0418\u041d\u041d[$i] -ne $null){ if ($in.\u0412\u043b\u043e\u0436\u0435\u043d\u0438\u0435.\u041f\u043e\u0434\u043f\u0438\u0441\u044c.\u0421\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442.\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435[$i] -ne \"\") { $arr_company+=($in.\u0412\u043b\u043e\u0436\u0435\u043d\u0438\u0435.\u041f\u043e\u0434\u043f\u0438\u0441\u044c.\u0421\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442.\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435[$i]) $arr_position+=($in.\u0412\u043b\u043e\u0436\u0435\u043d\u0438\u0435.\u041f\u043e\u0434\u043f\u0438\u0441\u044c.\u0421\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442.\u0414\u043e\u043b\u0436\u043d\u043e\u0441\u0442\u044c[$i]) }  if ($in.\u0412\u043b\u043e\u0436\u0435\u043d\u0438\u0435.\u041f\u043e\u0434\u043f\u0438\u0441\u044c.\u0421\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442.\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435[$i] -eq \"\"){ $arr_company+= ($in.\u0412\u043b\u043e\u0436\u0435\u043d\u0438\u0435.\u041f\u043e\u0434\u043f\u0438\u0441\u044c.\u0421\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442.\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435[$i]) $arr_position+=($in.\u0412\u043b\u043e\u0436\u0435\u043d\u0438\u0435.\u041f\u043e\u0434\u043f\u0438\u0441\u044c.\u0421\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442.\u0414\u043e\u043b\u0436\u043d\u043e\u0441\u0442\u044c[$i]) }    $arr_inn+=($in.\u0412\u043b\u043e\u0436\u0435\u043d\u0438\u0435.\u041f\u043e\u0434\u043f\u0438\u0441\u044c.\u0421\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442.\u0418\u041d\u041d[$i])  } else { $arr_company+=($in.\u0412\u043b\u043e\u0436\u0435\u043d\u0438\u0435.\u041f\u043e\u0434\u043f\u0438\u0441\u044c.\u0421\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442.\u0424\u0418\u041e[$i]) $arr_inn+=($in.\u0412\u043b\u043e\u0436\u0435\u043d\u0438\u0435.\u041f\u043e\u0434\u043f\u0438\u0441\u044c.\u0421\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442.\u0418\u041d\u041d[$i])  }  }   }     } $i++ } } }   } }  } #\u0435\u0441\u043b\u0438 \u0440\u0435\u0435\u0441\u0442\u0440\u0430 \u0440\u0430\u043d\u0435\u0435 \u043d\u0435 \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0445 \u0438\u0434\u0435\u043d\u0442\u0435\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u043e\u0432 \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0435\u0433\u043e else{ $Null | Export-Excel -Path $urlnofinish  -WorksheetName \"\u041b\u0438\u0441\u04421\"   -AutoSize   $book = Open-ExcelPackage -Path $urlnofinish $worksheet = $book.Workbook.Worksheets['\u041b\u0438\u0441\u04421']  $worksheet.Cells[1,1].Value = \"\u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\" $worksheet.Cells[1,2].Value = \"\u0421\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435\"  Close-ExcelPackage $book   }         $JsonBodyQuery2 = '{     \"jsonrpc\": \"2.0\",    \"method\": \"\u0421\u0411\u0418\u0421.\u0421\u043f\u0438\u0441\u043e\u043a\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432\",    \"params\": {       \"\u0424\u0438\u043b\u044c\u0442\u0440\": {          \"\u0414\u0430\u0442\u0430\u0421\": \"'+$s+'\",  \"\u0414\u0430\u0442\u0430\u041f\u043e\": \"'+$po+'\",  \"\u041d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435\": \"\u0418\u0441\u0445\u043e\u0434\u044f\u0449\u0438\u0439\",          \"\u0422\u0438\u043f\": \"\u0414\u043e\u043a\u041e\u0442\u0433\u0440\u0418\u0441\u0445\",  \"\u041d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u044f\": {         \"\u0420\u0430\u0437\u043c\u0435\u0440\u0421\u0442\u0440\u0430\u043d\u0438\u0446\u044b\": \"'+$itempagecount+'\",         \"\u0421\u0442\u0440\u0430\u043d\u0438\u0446\u0430\" : \"'+$page+'\" }       }    },    \"id\": 0   }'    $i=0     $Docs =  Invoke-RestMethod -Method Post -ContentType \"application\/json-rpc;charset=utf-8\" -Uri $urlquery -Body $JsonBodyquery2 -Headers $headers   while ($flag -eq 0) {   $Ids = $Docs.result.\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442     foreach ($id in $Ids) {  $JsonBodyQuery4 =  '{    \"jsonrpc\": \"2.0\",    \"method\": \"\u0421\u0411\u0418\u0421.\u041f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\",    \"params\": {       \"\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\": {          \"\u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\": \"'+ $id.\u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440+ '\",          \"\u0414\u043e\u043f\u041f\u043e\u043b\u044f\": \"\u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435\u041f\u043e\u043b\u044f\"       }    },    \"id\": 0 }' #\u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u043f\u043e\u0434\u043f\u0438\u0441\u0438 if (($id.\u0421\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435.\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 -ne \"\u0412\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043e \u0443\u0441\u043f\u0435\u0448\u043d\u043e\")  -and ($id.\u0421\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435.\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 -ne \"\u0412\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043e \u0441 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430\u043c\u0438\")) { if ($arr_nofinish_id -notcontains $id.\u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440){ $arr_nofinish_id += $id.\u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 $arr_nofinish_status += $id.\u0421\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435.\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 } }  else {   $ArrNames =  Invoke-RestMethod -Method Post -ContentType \"application\/json-rpc;charset=utf-8\" -Uri $urlquery -Body $JsonBodyquery4 -Headers $headers   $inboxes =  $ArrNames.result.\u0421\u043e\u0431\u044b\u0442\u0438\u0435  foreach ( $inbox in $inboxes){   if ($inbox.\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 -eq \"\u0423\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u0435 \u043e \u043f\u0440\u0438\u0435\u043c\u0435\"   ){ $tinboxes = $inbox.\u0412\u043b\u043e\u0436\u0435\u043d\u0438\u0435.\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 $i=0  foreach ($tinbox in $tinboxes ){ if ($tinbox.Contains(\"\u0442\u0438\u0442\u0443\u043b\")){    if ($inbox.\u0412\u043b\u043e\u0436\u0435\u043d\u0438\u0435.\u041f\u043e\u0434\u043f\u0438\u0441\u044c.\u0421\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442.\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435.Count -eq 1) {  $invlpodsertnaz = $inbox.\u0412\u043b\u043e\u0436\u0435\u043d\u0438\u0435.\u041f\u043e\u0434\u043f\u0438\u0441\u044c.\u0421\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442.\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 $invlpodsertfio = $inbox.\u0412\u043b\u043e\u0436\u0435\u043d\u0438\u0435.\u041f\u043e\u0434\u043f\u0438\u0441\u044c.\u0421\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442.\u0424\u0418\u041e $invlpodsertdol = $inbox.\u0412\u043b\u043e\u0436\u0435\u043d\u0438\u0435.\u041f\u043e\u0434\u043f\u0438\u0441\u044c.\u0421\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442.\u0414\u043e\u043b\u0436\u043d\u043e\u0441\u0442\u044c  } else{ $invlpodsertnaz = $inbox.\u0412\u043b\u043e\u0436\u0435\u043d\u0438\u0435.\u041f\u043e\u0434\u043f\u0438\u0441\u044c.\u0421\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442.\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435[$i] $invlpodsertfio = $inbox.\u0412\u043b\u043e\u0436\u0435\u043d\u0438\u0435.\u041f\u043e\u0434\u043f\u0438\u0441\u044c.\u0421\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442.\u0424\u0418\u041e[$i] $invlpodsertdol = $inbox.\u0412\u043b\u043e\u0436\u0435\u043d\u0438\u0435.\u041f\u043e\u0434\u043f\u0438\u0441\u044c.\u0421\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442.\u0414\u043e\u043b\u0436\u043d\u043e\u0441\u0442\u044c[$i] } $Namestring = ($invlpodsertnaz).ToUpper()  if ($invlpodsertnaz -ne '\u0421\u041e\u0411\u0421\u0422\u0412\u0415\u041d\u041d\u0410\u042f \u0424\u0418\u0420\u041c\u0410'){ $f = 0   foreach ($excel in $dataexcel) {  if ($excel.\u0424\u0418\u041e -eq $invlpodsertfio) { $f = 1 if ($excel.\u0414\u0430\u0442\u0430 -eq $null){  } else { if($excel.\u0414\u043e\u0432\u0435\u0440\u0435\u043d\u043d\u043e\u0441\u0442\u044c -ne \"\u0423\u0441\u0442\u0430\u0432\"){ if ($date -gt $excel.\u0414\u0430\u0442\u0430_\u0438\u0441\u0442\u0435\u0447\u0435\u043d\u0438\u044f_\u0434\u043e\u0432\u0435\u0440\u0435\u043d\u043d\u043e\u0441\u0442\u0438){  #Write-Host \u0414\u043e\u0432\u0435\u0440\u0435\u043d\u043d\u043e\u0441\u0442\u044c $excel.\u0424\u0418\u041e  \u0438\u0441\u0442\u0435\u043a\u043b\u0430 \u0438\u043b\u0438 \u043d\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0430 \u0434\u0430\u0442\u0430 \u0438\u0441\u0442\u0435\u0447\u0435\u043d\u0438\u044f  if($arr_data_name -notcontains $invlpodsertfio) { $arr_data_name +=($invlpodsertfio) $arr_data_company +=($invlpodsertnaz) $arr_data_master +=($excel.\u041e\u0442\u0432\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439) $arr_data_email+=($excel.Email) $arr_data_position +=($excel.\u0414\u043e\u043b\u0436\u043d\u043e\u0441\u0442\u044c)  }  } } } }}  if ($f -eq 0 ){     if ( $arr_name -notcontains $invlpodsertfio) {  $arr_name+=($invlpodsertfio) if ($id.\u041a\u043e\u043d\u0442\u0440\u0430\u0433\u0435\u043d\u0442.\u0421\u0432\u042e\u041b.\u0418\u041d\u041d -ne $null){ if ($invlpodsertnaz -ne \"\") { $arr_company+=($invlpodsertnaz) $arr_position+=($invlpodsertdol) } if ($invlpodsertnaz -eq \"\"){ $arr_company+= ($id.\u041a\u043e\u043d\u0442\u0440\u0430\u0433\u0435\u043d\u0442.\u0421\u0432\u042e\u041b.\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435) $arr_position+=($invlpodsertdol) }  $arr_inn+=($id.\u041a\u043e\u043d\u0442\u0440\u0430\u0433\u0435\u043d\u0442.\u0421\u0432\u042e\u041b.\u0418\u041d\u041d)  } else { $arr_company+=($id.\u041a\u043e\u043d\u0442\u0440\u0430\u0433\u0435\u043d\u0442.\u0421\u0432\u0424\u041b.\u0424\u0430\u043c\u0438\u043b\u0438\u044f + \" \"+ $id.\u041a\u043e\u043d\u0442\u0440\u0430\u0433\u0435\u043d\u0442.\u0421\u0432\u0424\u041b.\u0418\u043c\u044f + \" \" + $id.\u041a\u043e\u043d\u0442\u0440\u0430\u0433\u0435\u043d\u0442.\u0421\u0432\u0424\u041b.\u041e\u0442\u0447\u0435\u0441\u0442\u0432\u043e )  $arr_inn+=($id.\u041a\u043e\u043d\u0442\u0440\u0430\u0433\u0435\u043d\u0442.\u0421\u0432\u0424\u041b.\u0418\u041d\u041d)  }  }   }   }  } $i++ } }  }       } } &lt;##>    $page+=1  $JsonBodyQuery2 = '{     \"jsonrpc\": \"2.0\",    \"method\": \"\u0421\u0411\u0418\u0421.\u0421\u043f\u0438\u0441\u043e\u043a\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432\",    \"params\": {       \"\u0424\u0438\u043b\u044c\u0442\u0440\": {          \"\u0414\u0430\u0442\u0430\u0421\": \"'+$s+'\",  \"\u0414\u0430\u0442\u0430\u041f\u043e\": \"'+$po+'\",  \"\u041d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435\": \"\u0418\u0441\u0445\u043e\u0434\u044f\u0449\u0438\u0439\",          \"\u0422\u0438\u043f\": \"\u0414\u043e\u043a\u041e\u0442\u0433\u0440\u0418\u0441\u0445\",  \"\u041d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u044f\": {         \"\u0420\u0430\u0437\u043c\u0435\u0440\u0421\u0442\u0440\u0430\u043d\u0438\u0446\u044b\": \"'+$itempagecount+'\",         \"\u0421\u0442\u0440\u0430\u043d\u0438\u0446\u0430\" : \"'+$page+'\" }       }    },    \"id\": 0   }'  $Docs =  Invoke-RestMethod -Method Post -ContentType \"application\/json-rpc;charset=utf-8\" -Uri $urlquery -Body $JsonBodyquery2 -Headers $headers  if ($Docs.result.\u041d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u044f.\u0415\u0441\u0442\u044c\u0415\u0449\u0435 -ne \"\u0414\u0430\") {$fl+=1} if ($fl -gt 1) {$flag=1}   }   Remove-Item -Path $urlnofinish $Null | Export-Excel -Path $urlnofinish  -WorksheetName \"\u041b\u0438\u0441\u04421\"   -AutoSize    $book = Open-ExcelPackage -Path $urlnofinish $worksheet = $book.Workbook.Worksheets['\u041b\u0438\u0441\u04421']   $worksheet.Cells[1,1].Value = \"\u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\" $worksheet.Cells[1,2].Value = \"\u0421\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435\" $i=0  for ($i=0; $i -lt $arr_nofinish_id.count; $i++ ){  $worksheet.Cells[($i+2),1].Value = $arr_nofinish_id[$i] $worksheet.Cells[($i+2),2].Value = $arr_nofinish_status[$i]   } Close-ExcelPackage $book    if ($arr_name -ne $null){  $book = Open-ExcelPackage -Path $pathxlsx $worksheet = $book.Workbook.Worksheets['\u041b\u0438\u0441\u04421'] $i = 0  $j = 0   $msg=\"\u0414\u043e\u0432\u0435\u0440\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u044b, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u0434\u043b\u044f:`n \" for ($i = 0; $i -lt ($arr_name.Count); $i++ ){ $worksheet.Cells[($dataexcel.Count+2+$i),1].Value = $arr_name[$i] $worksheet.Cells[($dataexcel.Count+2+$i),2].Value = $arr_company[$i] $worksheet.Cells[($dataexcel.Count+2+$i),3].Value = $arr_position[$i] $worksheet.Cells[($dataexcel.Count+2+$i),4].Value = $arr_inn[$i]  $msg+=$arr_name[$i]+ \" \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u044f \" + $arr_company[$i] +\" \u0434\u043e\u043b\u0436\u043d\u043e\u0441\u0442\u044c \"+ $arr_position[$i] +\" \u0418\u041d\u041d \" + $arr_inn[$i]  +\"`n\" } Close-ExcelPackage $book   Write-Host $msg }   $i = 0  $j = 0   $arr_unic_data_email =@()  for($i=0;$i -le ($arr_data_email.Count-1); $i++){ if ($arr_unic_data_email -notcontains $arr_data_email[$i] ){ $arr_unic_data_email += ($arr_data_email[$i]) } }    $msg =\"\" for($j=0;$j -le ($arr_unic_data_email.Count-1); $j++){ $msg =\"\u0414\u0430\u0442\u0430 \u0434\u043e\u0432\u0435\u0440\u0435\u043d\u043d\u043e\u0441\u0442\u0435\u0439 \u0438\u0441\u0442\u0435\u043a\u043b\u0430 \u0434\u043b\u044f:`n\" for($i=0;$i -le $arr_data_name.Count; $i++){ if ($arr_unic_data_email[$j] -eq $arr_data_email[$i]) { $msg += $arr_data_name[$i] +\" \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u044f \"+$arr_data_company[$i] +\" \u0434\u043e\u043b\u0436\u043d\u043e\u0441\u0442\u044c \" + $arr_data_position[$i] +\" \u041e\u0442\u0432\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \"+ $arr_data_master[$i] +\"`n\" } } Write-Host \"\u041f\u0438\u0441\u044c\u043c\u043e \u0434\u043b\u044f\"$arr_unic_data_email[$j]\"`n\"$msg }  $dataexcel = Import-Excel -Path $pathxlsx $i=0 $book = Open-ExcelPackage -Path $pathxlsx $worksheet = $book.Workbook.Worksheets['\u041b\u0438\u0441\u04421'] for ($i=2; $i -lt $dataexcel.Count; $i++){ #Write-Host $i ----- $worksheet.Cells[$i,3].Value if ($worksheet.Cells[$i,3].Value -ne \"\"){ $str = (($worksheet.Cells[$i,3].Value)).ToUpper() if (($str -eq \"\u0413\u0415\u041d\u0415\u0420\u0410\u041b\u042c\u041d\u042b\u0419 \u0414\u0418\u0420\u0415\u041a\u0422\u041e\u0420\") -or ($str -eq \"\u041f\u0420\u0415\u0417\u0418\u0414\u0415\u041d\u0422\") -or ($str -eq \"\u0414\u0418\u0420\u0415\u041a\u0422\u041e\u0420\")){ $worksheet.Cells[$i,5].Value = \"\u0423\u0441\u0442\u0430\u0432\"  } } }  Close-ExcelPackage $book      Invoke-RestMethod -Method Post -ContentType \"application\/json-rpc;charset=utf-8\" -Uri $url -Body $JsonBody_close -Headers $headers }   ChekSbis -dStart \"10.01.2023\" -dEnd \"16.06.2023\" # \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0434\u043b\u044f \u043f\u0435\u0440\u0438\u043e\u0434\u0430 #ChekSbis  \u0437\u0430\u043f\u0443\u0441\u043a \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0437\u0430 \u0432\u0447\u0435\u0440\u0430 <\/code><\/pre>\n<h2>\u0414\u0438\u0430\u0434\u043e\u043a<\/h2>\n<p>\u041b\u043e\u0433\u0438\u043a\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a\u0430\u044f \u0436\u0435, \u0442\u043e\u043b\u044c\u043a\u043e \u043a\u043b\u044e\u0447 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u043a \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u043c \u0434\u0438\u0430\u0434\u043e\u043a\u0430 \u0441\u0442\u043e\u0438\u0442 \u0434\u0435\u043d\u0435\u0433 \u0432 \u0433\u043e\u0434. \u0418 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044f \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0434\u0440\u0443\u0433\u043e\u0439 \u0432\u0438\u0434 \u0438\u043c\u0435\u0435\u0442. \u00a0\u00a0\u041f\u043e-\u044d\u0442\u043e\u043c\u0443 \u0432\u044b\u043b\u043e\u0436\u0443 \u043f\u0440\u043e\u0441\u0442\u043e \u043a\u043e\u0434 \u0446\u0435\u043b\u0438\u043a\u043e\u043c \u0431\u0435\u0437 \u043f\u043e\u044f\u0441\u043d\u0435\u043d\u0438\u0439. <\/p>\n<pre><code class=\"powershell\">function ChekKontur{ [CmdletBinding()]    param(    $dStart = (((date).Day - 1).ToString() + \".\" + ((date).Month).ToString() + \".\" +((date).Year).ToString()),      $dEnd = (((date).Day - 1).ToString() + \".\" + ((date).Month).ToString() + \".\" +((date).Year).ToString())        )  $url = \"https:\/\/diadoc-api.kontur.ru\/v3\/Authenticate?type=password\" $docc = 100 $Docs = @() $pathxlsx = \"C:\\Bin\\Scripts\\ChekSign\\\u0414\u043e\u0432\u0435\u0440\u0435\u043d\u043d\u043e\u0441\u0442\u0438.xlsx\" $pathnofinish  = \"C:\\Bin\\Scripts\\ChekSign\\NoFinish.xlsx\" $s = $dStart $po= $dEnd $docstatus= \"Any.OutboundNotRevoked\" $dataexcel = Import-Excel -Path $pathxlsx $date = date $arr_name = @() $arr_company = @() $arr_inn = @() $arr_kpp = @() $arr_data_name = @() $arr_data_company = @() $arr_data_master = @() $arr_data_email = @() $arr_nofinish_idmessage = @() $arr_nofinish_entityId  = @() $arr_nofinish_status = @() $arr_check_nofinish_idmessage = @() $arr_check_nofinish_entityId  = @() $arr_check_nofinish_status = @() $arr_nodate = @{} $arr_data_position = @() $arr_position = @() $arr_data_title  =@()           $Header =@{ \"Authorization\" = \"DiadocAuth ddauth_api_client_id=API-\u043a\u043b\u044e\u0447\" \"ContentLength\"= \"1252\" \"Content-Type\"= \"application\/json\" }    $Body = '{ \"login\": \"api_\u043b\u043e\u0433\u0438\u043d\", \"password\": \"\u043f\u0430\u0440\u043e\u043b\u044c\" }' $token2 = Invoke-RestMethod -Method Post -Uri $url -Headers $Header -Body $Body  $auth = \"DiadocAuth ddauth_api_client_id=API-\u043a\u043b\u044e\u0447,ddauth_token=\" +$token2 $url2=\"https:\/\/diadoc-api.kontur.ru\/GetMyOrganizations\"  $Header2 =@{ \"Authorization\" = $auth \"ContentLength\"= \"1252\" \"Content-Type\"= \"application\/json\" }  $Header5 = @{ \"Authorization\" = $auth \"ContentLength\"= \"1252\" \"Content-Type\"= \"application\/json\" }    $Box = Invoke-RestMethod  -Uri $url2 -Headers $Header2 -Method GET   $BoxID =  $Box.Organizations.Boxes.BoxId $OrigId = $Box.Organizations.OrgId  $url3=\"https:\/\/diadoc-api.kontur.ru\/v3\/GetDocuments\"   $Body2 = @{  \"boxid\" = $BoxID  \"filterCategory\"=$docstatus  \"fromDocumentDate\"=$s  \"toDocumentDate\"=$po  \"count\"= $docc }  $doc = Invoke-RestMethod  -Uri $url3 -Headers $Header2 -Body $Body2 -Method GET  $doctotal = $doc.TotalCount Write-Host Documentov ---------------------------------------------------------- $doc.TotalCount $doccount = $doc.Documents.Count $i=1  $Docs += $doc.Documents  $docchangetotal = $doctotal  while ($doccount -lt $doctotal){ $i++ $docchangetotal = $doctotal - $docc if ($docchangetotal -lt $docc) {$docc = $docchangetotal}   $Body2 = @{  \"boxid\" = $BoxID  \"filterCategory\"=$docstatus  \"fromDocumentDate\"=$s  \"toDocumentDate\"=$po  \"count\"=$docc  \"afterIndexKey\" = $doc.Documents.IndexKey[-1]  }  $doc = Invoke-RestMethod  -Uri $url3 -Headers $Header2 -Body $Body2 -Method GET    $doccount += $doc.Documents.Count $Docs += $doc.Documents  }   #\u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u043d\u0435 \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b  $nofinish = $Null   $nofinish = Import-Excel -Path $pathnofinish   if ($nofinish -ne $Null){  Remove-Item -Path $pathnofinish  $Null | Export-Excel -Path $pathnofinish  -WorksheetName \"\u041b\u0438\u0441\u04421\"   -AutoSize     $book = Open-ExcelPackage -Path $pathnofinish $worksheet = $book.Workbook.Worksheets['\u041b\u0438\u0441\u04421'] $i = 0  $j = 0  $worksheet.Cells[1,1].Value = \"boxId\" $worksheet.Cells[1,2].Value = \"MessageID\" $worksheet.Cells[1,3].Value = \"entityId\" $worksheet.Cells[1,4].Value = \"DocumentStatus\"  $url10=\"https:\/\/diadoc-api.kontur.ru\/V3\/GetDocument\"   foreach ($row in $nofinish){      $Body10 = @{  \"boxId\" = $row.boxId  \"entityId\" = $row.entityId  \"messageId\" = $row.MessageID   }            $check = Invoke-RestMethod  -Uri $url10 -Headers $Header2 -Body $Body10 -Method GET #$check.UniversalTransferDocumentMetadata.DocumentStatus if ($check.UniversalTransferDocumentMetadata.DocumentStatus -eq \"OutboundWithRecipientSignature\" ){   $url8=\"https:\/\/diadoc-api.kontur.ru\/V5\/GetMessage\" $url9=\"https:\/\/diadoc-api.kontur.ru\/GetSignatureInfo\"  $Header2 =@{ \"Authorization\" = $auth \"ContentLength\"= \"1252\" \"Content-Type\"= \"application\/json\" }    $Body8 = @{  \"boxId\" = $BoxID  \"messageId\" = $row.messageid    }                 $sertreq = Invoke-RestMethod  -Uri $url8 -Headers $Header2 -Body $Body8 -Method GET  $signs = $sertreq.Entities ForEach ($sign in $signs){ if ($sign.EntityType -eq \"Signature\") { $Body9 = @{  \"boxId\" = $BoxID  \"messageId\" =$row.messageid  \"entityId\" = $sign.EntityId   }  $signdata = Invoke-RestMethod  -Uri $url9 -Headers $Header2 -Body $Body9 -Method GET    if ($signdata.OrgInn -ne '\u0418\u041d\u041d \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f') { $f = 0   foreach ($excel in $dataexcel) { if ($excel.\u0424\u0418\u041e -eq ($signdata.Surname+\" \"+$signdata.FirstName)) { $f = 1 if ($excel.\u0414\u0430\u0442\u0430_\u0438\u0441\u0442\u0435\u0447\u0435\u043d\u0438\u044f_\u0434\u043e\u0432\u0435\u0440\u0435\u043d\u043d\u043e\u0441\u0442\u0438 -eq $null){ } else { if ($date -gt $excel.\u0414\u0430\u0442\u0430_\u0438\u0441\u0442\u0435\u0447\u0435\u043d\u0438\u044f_\u0434\u043e\u0432\u0435\u0440\u0435\u043d\u043d\u043e\u0441\u0442\u0438){   if($arr_data_name -notcontains ($signdata.Surname+\" \"+$signdata.FirstName)) { $arr_data_name +=(($signdata.Surname+\" \"+$signdata.FirstName)) $arr_data_company +=($signdata.OrgName) $arr_data_master +=($excel.\u041e\u0442\u0432\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439) $arr_data_email+=($excel.Email) $arr_data_position += ($excel.\u0414\u043e\u043b\u0436\u043d\u043e\u0441\u0442\u044c)  }  } } }}   if ($f -eq 0 ){   if ( $arr_name -notcontains ($signdata.Surname+\" \"+$signdata.FirstName)) {  $arr_name+=(($signdata.Surname+\" \"+$signdata.FirstName)) $arr_company+= ($signdata.OrgName) $arr_inn+=($signdata.OrgInn) $arr_position+=($signdata.JobTitle)  }    }   }         }  }  } else {   $arr_check_nofinish_idmessage += $check.MessageID $arr_check_nofinish_entityId += $check.entityId $arr_check_nofinish_status += $check.UniversalTransferDocumentMetadata.DocumentStatus }   }     if ($arr_check_nofinish_idmessage.Count -gt 1) {  for ($i=0; $i-le ($arr_check_nofinish_idmessage.Count-1); $i++){  $worksheet.Cells[($i+2),1].Value = $BoxID $worksheet.Cells[($i+2),2].Value = $arr_check_nofinish_idmessage[$i] $worksheet.Cells[($i+2),3].Value = $arr_check_nofinish_entityId[$i] $worksheet.Cells[($i+2),4].Value = $arr_check_nofinish_status[$i] } } Close-ExcelPackage $book   }  $nofinish = $Null  $nofinish = Import-Excel -Path $pathnofinish    if ($nofinish -ne $null) { foreach ($row in $nofinish){ $arr_nofinish_idmessage +=$row.MessageID $arr_nofinish_entityId +=$row.entityId $arr_nofinish_status +=$row.DocumentStatus }  }  $i=1    foreach ($message in $Docs) {      if (($message.UniversalTransferDocumentMetadata.DocumentStatus -eq \"OutboundWithRecipientSignature\" ) -or ($message.UniversalCorrectionDocumentMetadata.DocumentStatus -eq \"OutboundWithRecipientSignature\" )){  $url8=\"https:\/\/diadoc-api.kontur.ru\/V5\/GetMessage\" $url9=\"https:\/\/diadoc-api.kontur.ru\/GetSignatureInfo\"  $Header2 =@{ \"Authorization\" = $auth \"ContentLength\"= \"1252\" \"Content-Type\"= \"application\/json\" }    $Body8 = @{  \"boxId\" = $BoxID  \"messageId\" = $message.messageid    }                 $sertreq = Invoke-RestMethod  -Uri $url8 -Headers $Header2 -Body $Body8 -Method GET  $signs = $sertreq.Entities ForEach ($sign in $signs){ if ($sign.EntityType -eq \"Signature\") { $Body9 = @{  \"boxId\" = $BoxID  \"messageId\" =$message.messageid  \"entityId\" = $sign.EntityId   }  $signdata = Invoke-RestMethod  -Uri $url9 -Headers $Header2 -Body $Body9 -Method GET     if ($signdata.OrgInn -ne '\u0418\u041d\u041d \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f') { $f = 0   foreach ($excel in $dataexcel) { if ($excel.\u0424\u0418\u041e -eq ($signdata.Surname+\" \"+$signdata.FirstName)) {  $f = 1 $changetitle = 0  if (($excel.\u0414\u043e\u043b\u0436\u043d\u043e\u0441\u0442\u044c -eq \"\u0413\u0415\u041d\u0415\u0420\u0410\u041b\u042c\u041d\u042b\u0419 \u0414\u0418\u0420\u0415\u041a\u0422\u041e\u0420\") -or ($excel.\u0414\u043e\u043b\u0436\u043d\u043e\u0441\u0442\u044c -eq \"\u041f\u0420\u0415\u0417\u0418\u0414\u0415\u041d\u0422\") -or ($excel.\u0414\u043e\u043b\u0436\u043d\u043e\u0441\u0442\u044c -eq \"\u0414\u0418\u0420\u0415\u041a\u0422\u041e\u0420\")){ if (($signdata.JobTitle -ne \"\u0413\u0415\u041d\u0415\u0420\u0410\u041b\u042c\u041d\u042b\u0419 \u0414\u0418\u0420\u0415\u041a\u0422\u041e\u0420\") -and ($signdata.JobTitle -ne \"\u041f\u0420\u0415\u0417\u0418\u0414\u0415\u041d\u0422\") -and ($signdata.JobTitle -ne \"\u0414\u0418\u0420\u0415\u041a\u0422\u041e\u0420\")){ $changetitle = 1 }  }  if ($excel.\u0414\u0430\u0442\u0430_\u0438\u0441\u0442\u0435\u0447\u0435\u043d\u0438\u044f_\u0434\u043e\u0432\u0435\u0440\u0435\u043d\u043d\u043e\u0441\u0442\u0438 -eq $null){ } else { if($excel.\u0414\u043e\u0432\u0435\u0440\u0435\u043d\u043d\u043e\u0441\u0442\u044c -ne \"\u0423\u0441\u0442\u0430\u0432\"){ if ($date -gt $excel.\u0414\u0430\u0442\u0430_\u0438\u0441\u0442\u0435\u0447\u0435\u043d\u0438\u044f_\u0434\u043e\u0432\u0435\u0440\u0435\u043d\u043d\u043e\u0441\u0442\u0438){   if($arr_data_name -notcontains ($signdata.Surname+\" \"+$signdata.FirstName)) { $arr_data_name +=(($signdata.Surname+\" \"+$signdata.FirstName)) $arr_data_company +=($signdata.OrgName) $arr_data_master +=($excel.\u041e\u0442\u0432\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439) $arr_data_email+=($excel.Email) $arr_data_position+=($excel.\u0414\u043e\u043b\u0436\u043d\u043e\u0441\u0442\u044c) if ($changetitle -eq 1 ){ $arr_data_title += $signdata.JobTitle } else{ $arr_data_title += \"NO\" }  }  } }  }   }}   if ($f -eq 0 ){   if ( $arr_name -notcontains ($signdata.Surname+\" \"+$signdata.FirstName)) {  $arr_name+=(($signdata.Surname+\" \"+$signdata.FirstName)) $arr_company+= ($signdata.OrgName) $arr_inn+=($signdata.OrgInn) $arr_position+=($signdata.JobTitle)  }    }   }         }  }   } else { if (($message.UniversalTransferDocumentMetadata.DocumentStatus -ne \"OutboundRecipientSignatureRequestRejected\") -or ($message.UniversalCorrectionDocumentMetadata.DocumentStatus -ne \"OutboundRecipientSignatureRequestRejected\" )){     if ($arr_check_nofinish_entityId -notcontains $message.EntityId  ){ $arr_nofinish_idmessage += $message.MessageId $arr_nofinish_entityId  += $message.EntityId if ($message.DocumentType -eq \"UniversalCorrectionDocument\") { $arr_nofinish_status += $message.UniversalCorrectionDocumentMetadata.DocumentStatus } if ($message.DocumentType -eq \"UniversalTransferDocument\") { $arr_nofinish_status += $message.UniversalTransferDocumentMetadata.DocumentStatus } } }  }    }    Remove-Item -Path $pathnofinish  $Null | Export-Excel -Path $pathnofinish  -WorksheetName \"\u041b\u0438\u0441\u04421\"   -AutoSize        $book = Open-ExcelPackage -Path $pathnofinish $worksheet = $book.Workbook.Worksheets['\u041b\u0438\u0441\u04421'] $i = 0  $j = 0  $worksheet.Cells[1,1].Value = \"boxId\" $worksheet.Cells[1,2].Value = \"MessageID\" $worksheet.Cells[1,3].Value = \"entityId\" $worksheet.Cells[1,4].Value = \"DocumentStatus\" if ($arr_nofinish_idmessage.Count -gt 1){ for ($i=0; $i-le ($arr_nofinish_idmessage.Count-1); $i++){  $worksheet.Cells[($i+2),1].Value = $BoxID $worksheet.Cells[($i+2),2].Value = $arr_nofinish_idmessage[$i] $worksheet.Cells[($i+2),3].Value = $arr_nofinish_entityId[$i] $worksheet.Cells[($i+2),4].Value = $arr_nofinish_status[$i] } } Close-ExcelPackage $book   $arr_name   if ($arr_name -ne $null){  $book = Open-ExcelPackage -Path $pathxlsx $worksheet = $book.Workbook.Worksheets['\u041b\u0438\u0441\u04421'] $i = 0  $j = 0   $msg=\"\u0414\u043e\u0432\u0435\u0440\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u044b, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u0434\u043b\u044f:`n &lt;br \/> \" for ($i = 0; $i -lt ($arr_name.Count); $i++ ){ $worksheet.Cells[($dataexcel.Count+2+$i),1].Value = $arr_name[$i] $worksheet.Cells[($dataexcel.Count+2+$i),2].Value = $arr_company[$i] $worksheet.Cells[($dataexcel.Count+2+$i),3].Value = $arr_position[$i] $worksheet.Cells[($dataexcel.Count+2+$i),4].Value = $arr_inn[$i] if (($arr_inn[$i] -eq \"\u0413\u0415\u041d\u0415\u0420\u0410\u041b\u042c\u041d\u042b\u0419 \u0414\u0418\u0420\u0415\u041a\u0422\u041e\u0420\") -or ($arr_inn[$i] -eq \"\u041f\u0420\u0415\u0417\u0418\u0414\u0415\u041d\u0422\") -or ($arr_inn[$i] -eq \"\u0414\u0418\u0420\u0415\u041a\u0422\u041e\u0420\")){ $worksheet.Cells[($dataexcel.Count+2+$i),5].Value = \"\u0423\u0441\u0442\u0430\u0432\"  } else{ $msg+=$arr_name[$i]+ \" \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u044f \" + $arr_company[$i] +\" \u0434\u043e\u043b\u0436\u043d\u043e\u0441\u0442\u044c \"+ $arr_position[$i] +\" \u0418\u041d\u041d \" + $arr_inn[$i] +\"`n &lt;br \/>\" } } Close-ExcelPackage $book   Write-Host $msg  }   $i = 0  $j = 0   $arr_unic_data_email =@()  for($i=0;$i -le ($arr_data_email.Count-1); $i++){ if ($arr_unic_data_email -notcontains $arr_data_email[$i] ){ $arr_unic_data_email += ($arr_data_email[$i]) } }    $msg =\"\" for($j=0;$j -le ($arr_unic_data_email.Count-1); $j++){ $msg =\"\u0414\u0430\u0442\u0430 \u0434\u043e\u0432\u0435\u0440\u0435\u043d\u043d\u043e\u0441\u0442\u0435\u0439 \u0438\u0441\u0442\u0435\u043a\u043b\u0430 \u0434\u043b\u044f:`n &lt;br \/>\" for($i=0;$i -le $arr_data_name.Count; $i++){ if ($arr_unic_data_email[$j] -eq $arr_data_email[$i]) {  if ($arr_data_title[$i] -ne \"NO\"){ $msg +=$arr_data_name[$i] +\" \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u044f \"+$arr_data_company[$i] + \" \u0434\u043e\u043b\u0436\u043d\u043e\u0441\u0442\u044c  \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u0430\u0441\u044c \u043d\u0430: \" + $arr_data_title[$i] +  \"`n &lt;br \/>\" } else{ $msg += $arr_data_name[$i] +\" \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u044f \"+$arr_data_company[$i] + \" \u0434\u043e\u043b\u0436\u043d\u043e\u0441\u0442\u044c \" + $arr_data_position[$i] +\" \u041e\u0442\u0432\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \"+ $arr_data_master[$i] +\"`n &lt;br \/>\" }  } } Write-Host \"\u041f\u0438\u0441\u044c\u043c\u043e \u0434\u043b\u044f\"$arr_unic_data_email[$j]  \"`n\" $msg  }  $dataexcel = Import-Excel -Path $pathxlsx $i=0 $book = Open-ExcelPackage -Path $pathxlsx $worksheet = $book.Workbook.Worksheets['\u041b\u0438\u0441\u04421'] for ($i=2; $i -lt $dataexcel.Count; $i++){ if ($worksheet.Cells[$i,3].Value -ne \"\"){ $str = ($worksheet.Cells[$i,3].Value).ToUpper()} if (($str -eq \"\u0413\u0415\u041d\u0415\u0420\u0410\u041b\u042c\u041d\u042b\u0419 \u0414\u0418\u0420\u0415\u041a\u0422\u041e\u0420\") -or ($str -eq \"\u041f\u0420\u0415\u0417\u0418\u0414\u0415\u041d\u0422\") -or ($str -eq \"\u0414\u0418\u0420\u0415\u041a\u0422\u041e\u0420\")){ $worksheet.Cells[$i,5].Value = \"\u0423\u0441\u0442\u0430\u0432\"  }  } Close-ExcelPackage $book   }  ChekKontur -dStart \"01.01.2023\" -dEnd \"28.02.2023\" <\/code><\/pre>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p> <!----> <!----><\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/742626\/\"> https:\/\/habr.com\/ru\/articles\/742626\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><\/figure>\n<p>\u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442. \u042d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0435\u0437\u043d\u0430 \u0442\u0435\u043c, \u043a\u0442\u043e \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0441\u044f \u0441 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439 \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a \u0434\u043e\u0432\u0435\u0440\u0435\u043d\u043d\u043e\u0441\u0442\u0435\u0439 \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u044b\u043c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u043e\u0431\u043e\u0440\u043e\u0442\u043e\u043c \u0447\u0435\u0440\u0435\u0437 \u0421\u0411\u0418\u0421 \u0438 \u0414\u0438\u0430\u0434\u043e\u043a.\u00a0 \u0420\u0435\u0447\u044c \u0438\u0434\u0435\u0442 \u043d\u0435 \u043e \u041c\u0427\u0414 (\u043c\u0430\u0448\u0438\u043d\u043e\u0447\u0438\u0442\u0430\u0435\u043c\u043e\u0439 \u0434\u043e\u0432\u0435\u0440\u0435\u043d\u043d\u043e\u0441\u0442\u0438), \u0430 \u043e \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0435 \u043e\u0431\u044b\u0447\u043d\u044b\u0445 \u0431\u0443\u043c\u0430\u0436\u043d\u044b\u0445 \u0434\u043e\u0432\u0435\u0440\u043e\u043a. <\/p>\n<p>\u0422\u0430\u043a \u0436\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043a\u043e\u043c\u0443 \u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0435\u0437\u043d\u043e \u043f\u043e\u0447\u0435\u0440\u043f\u043d\u0443\u0442\u044c \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u044b \u0440\u0430\u0431\u043e\u0442\u044b \u0447\u0435\u0440\u0435\u0437 API.<\/p>\n<p>\u041a\u043e \u043c\u043d\u0435 \u044d\u0442\u0430 \u0437\u0430\u0434\u0430\u0447\u0430 \u043f\u0440\u0438\u043b\u0435\u0442\u0435\u043b\u0430 \u043e\u0442 \u044e\u0440\u0438\u0441\u0442\u043e\u0432, \u043d\u0430\u0448\u0435\u0439 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u043b\u0438 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u044b \u0432\u0440\u0443\u0447\u043d\u0443\u044e. (\u0441\u043c\u043e\u0442\u0440\u0435\u043b\u0438 \u0432\u0440\u0443\u0447\u043d\u0443\u044e \u043a\u0435\u043c \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442 \u0438 \u043f\u043e\u0442\u043e\u043c \u0438\u0441\u043a\u0430\u043b\u0438 \u044d\u0442\u0443 \u0434\u043e\u0432\u0435\u0440\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u0432 \u0441\u043a\u0430\u043d\u0430\u0445. <\/p>\n<p>1.\u00a0\u041f\u0435\u0440\u0432\u043e\u0435 \u0447\u0442\u043e \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u044d\u0442\u043e \u0440\u0435\u0435\u0441\u0442\u0440 \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u0442\u043e\u0432 \u043a\u043e\u043d\u0442\u0440\u0430\u0433\u0435\u043d\u0442\u043e\u0432. \u0424\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0432 \u043f\u043e\u043b\u0443 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u043c \u0440\u0435\u0436\u0438\u043c\u0435, \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u043e\u043c \u043f\u043e\u0434\u0433\u0440\u0443\u0436\u0430\u0435\u0442\u0441\u044f: \u0424\u0418\u041e, \u0434\u043e\u043b\u0436\u043d\u043e\u0441\u0442\u044c, \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438, \u0418\u041d\u041d. \u0414\u0430\u043b\u0435\u0435 \u0432\u0440\u0443\u0447\u043d\u0443\u044e \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u043f\u043e\u043b\u044f: \u0434\u0430\u0442\u0430 \u0438\u0441\u0442\u0435\u0447\u0435\u043d\u0438\u044f \u0434\u043e\u0432\u0435\u0440\u0435\u043d\u043d\u043e\u0441\u0442\u0438, \u043d\u043e\u043c\u0435\u0440 \u0434\u043e\u0432\u0435\u0440\u0435\u043d\u043d\u043e\u0441\u0442\u0438, \u0424\u0418\u041e \u0438 \u043f\u043e\u0447\u0442\u0430 \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u0437\u0430 \u043a\u043e\u043d\u0442\u0440\u0430\u0433\u0435\u043d\u0442\u0430, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0424\u0418\u041e \u0438 \u043f\u043e\u0447\u0442\u0430 \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044f \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e. <\/p>\n<p>2.\u00a0\u0420\u0435\u0435\u0441\u0442\u0440 \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u043d\u043d\u044b\u0445 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432, \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0435\u0449\u0435 \u043d\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u043b\u0441\u044f \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u043e\u0431\u043e\u0440\u043e\u0442. \u042d\u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0447\u0442\u043e \u0431\u044b \u043d\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 \u043d\u0430 \u0431\u043e\u043b\u044c\u0448\u0438\u0435 \u0441\u0440\u043e\u043a\u0438 \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432. (\u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u044e \u0441\u043a\u0440\u0438\u043f\u0442, \u0447\u0438\u0442\u0430\u044e\u0449\u0438\u0439 \u0432\u0447\u0435\u0440\u0430\u0448\u043d\u044e\u044e \u0434\u0430\u0442\u0443) \u0435\u0441\u043b\u0438 \u043d\u0443\u0436\u0435\u043d \u0434\u0440\u0443\u0433\u043e\u0439 \u043f\u0435\u0440\u0438\u043e\u0434 \u2014 \u044d\u0442\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 \u0441\u043a\u0440\u0438\u043f\u0442\u0430.\u00a0 \u0420\u0435\u0435\u0441\u0442\u0440 \u043d\u0435\u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u044b\u0445 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0445\u0440\u0430\u043d\u0438\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u0432\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f. \u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430 \u0438 \u0435\u0433\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435. <\/p>\n<p>\u0414\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438  \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b API \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0421\u0411\u0418\u0421 \u0438 \u0414\u0438\u0430\u0434\u043e\u043a. <\/p>\n<p>\u0412\u0435\u0441\u044c \u043a\u043e\u0434 \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u043d\u0430 PowerShell. <\/p>\n<p>\u041e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u0440\u0430\u0437\u043e\u0431\u044c\u044e \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0445 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432. <\/p>\n<h2>\u0421\u0411\u0418\u0421<\/h2>\n<p>1.\u00a0\u0421\u0430\u043c\u043e\u0435 \u043f\u0435\u0440\u0432\u043e\u0435 \u0447\u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u043f\u0440\u043e\u0439\u0442\u0438 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044e \u043d\u0430 \u0441\u0435\u0440\u0432\u0438\u0441\u0435. <\/p>\n<p>API \u0441\u0431\u0438\u0441\u0430 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0432\u0441\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 JSON \u0447\u0442\u043e \u0431\u044b \u043d\u0435 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u0430\u0441\u0441\u0438\u0432 \u0432 JSON \u00a0\u044f \u0441\u0440\u0430\u0437\u0443 \u043f\u0438\u0448\u0443 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 JSON.<\/p>\n<pre><code class=\"powershell\"> $url = \"https:\/\/online.sbis.ru\/auth\/service\/\" #\u041f\u0443\u0442\u044c \u0434\u043e \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u0432 API \u0421\u0411\u0418\u0421 $urlquery = \"https:\/\/online.sbis.ru\/service\/?srv=1\"    #\u0410\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044e \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u043c \u043f\u043e \u043b\u043e\u0433\u0438\u043d\u0443 \u0438 \u043f\u0430\u0440\u043e\u043b\u044e. $Body = '{     \"jsonrpc\":\"2.0\",     \"method\":\"\u0421\u0411\u0418\u0421.\u0410\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c\",     \"params\" :{        \"\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\":{           \"\u041b\u043e\u0433\u0438\u043d\":\"API_login\",           \"\u041f\u0430\u0440\u043e\u043b\u044c\":\" API_Password\"        }     },     \"id\":\"0\"  }' # \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u044d\u0442\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0442\u043e\u043a\u0435\u043d \u043e\u043d \u043d\u0443\u0436\u0435\u043d \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u043c \u0434\u043b\u044f \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0438\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432  $token = (Invoke-RestMethod -Method Post -ContentType \"application\/json-rpc;charset=utf-8\" -Uri $url -Body $Body).result    # \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u044d\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a \u0431\u0443\u0434\u0443\u0449\u0438\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432  $headers = @{     'X-SBISSessionID' = $token }  <\/code><\/pre>\n<p>2.\u00a0\u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0440\u0435\u0435\u0441\u0442\u0440 \u0434\u043e\u0432\u0435\u0440\u0435\u043d\u043d\u043e\u0441\u0442\u0435\u0439<\/p>\n<pre><code class=\"powershell\">$pathxlsx = \"E:\\Scripts\\ChekSign\\\u0414\u043e\u0432\u0435\u0440\u0435\u043d\u043d\u043e\u0441\u0442\u0438.xlsx\"  $dataexcel = Import-Excel -Path $pathxlsx <\/code><\/pre>\n<p>3. \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0440\u0435\u0435\u0441\u0442\u0440 \u0440\u0430\u043d\u0435\u0435 \u043d\u0435\u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u044b\u0445 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432, \u0435\u0441\u043b\u0438 \u0443 \u043d\u0438\u0445 \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u043e\u0441\u044c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043d\u0430 \u201c\u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043e\u201d \u0442\u043e \u043f\u0440\u043e\u0432\u0430\u043b\u0438\u0432\u0430\u0435\u043c\u0441\u044f \u0432\u0433\u043b\u0443\u0431\u044c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430, \u0432 \u043f\u0440\u043e\u0442\u0438\u0432\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0437\u0430\u043d\u043e\u0432\u043e \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u044d\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0440\u0435\u0435\u0441\u0442\u0440 \u043d\u0435\u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u044b\u0445 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 (\u0440\u0435\u0435\u0441\u0442\u0440 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043a\u0430\u0436\u0434\u044b\u0439 \u0437\u0430\u043f\u0443\u0441\u043a \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b, \u0447\u0442\u043e \u0431\u044b \u043d\u0435 \u0443\u0434\u0430\u043b\u044f\u0442\u044c \u043f\u043e\u0441\u0442\u0440\u043e\u0447\u043d\u043e \u0438\u0437 \u044d\u043a\u0441\u0435\u043b\u044f).<\/p>\n<p>\u0412\u043d\u0443\u0442\u0440\u0438 \u043f\u0430\u043a\u0435\u0442\u0430 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u043d\u0430\u0441 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u0435\u0442 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442 \u0441 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c \u201c\u0423\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u0435 \u043e \u043f\u0440\u0438\u0435\u043c\u0435\u201d. \u00a0\u0410 \u0447\u0442\u043e \u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0438\u043c\u0435\u043d\u043d\u043e \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u0442\u0430 (\u0442\u043e\u0433\u043e \u0447\u044c\u0435\u0439 \u044d\u0446\u043f \u0431\u044b\u043b \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442,\u00a0\u00a0 \u0430 \u043d\u0435 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u044b\u0445 \u043b\u0438\u0446) \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u0447\u043b\u0435\u043d\u044f\u0442\u044c \u0432\u043b\u043e\u0436\u0435\u043d\u0438\u0435\u00a0 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0441\u043b\u043e\u0432\u043e \u0442\u0438\u0442\u0443\u043b(\u0442\u0430\u043a\u0438\u0445 \u0432\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043c\u043d\u043e\u0433\u043e, \u043d\u043e \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0441\u0430\u043c\u043e\u0435 \u043f\u0435\u0440\u0432\u043e\u0435 \u0441 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u043c 0. <\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e \u043a\u0430\u043a \u0432\u044b\u0447\u043b\u0435\u043d\u0438\u043b\u0438 \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u0442\u0430 \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u0435\u043c \u0435\u0441\u0442\u044c \u043b\u0438 \u043e\u043d \u0432 \u043d\u0430\u0448\u0435\u043c \u0440\u0435\u0435\u0441\u0442\u0440\u0435 \u0434\u043e\u0432\u0435\u0440\u0435\u043d\u043d\u043e\u0441\u0442\u0435\u0439 \u0438 \u0435\u0441\u043b\u0438 \u043d\u0435\u0442, \u0442\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u043c\u0430\u0441\u0441\u0438\u0432\u044b, \u043f\u043e\u0437\u0436\u0435 \u044d\u0442\u0438 \u043c\u0430\u0441\u0441\u0438\u0432\u044b \u0431\u0443\u0434\u0443\u0442 \u0437\u0430\u043f\u0438\u0441\u0430\u043d\u044b \u0432 \u044d\u043a\u0441\u0435\u043b\u044c \u043e\u0431\u0440\u0430\u0442\u043d\u043e. <\/p>\n<p>\u0415\u0441\u043b\u0438 \u043a\u0440\u0430\u0442\u043a\u043e \u043d\u0443\u0436\u043d\u044b\u0439 \u043d\u0430\u043c \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0441\u044f \u043f\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c\u0443 \u043f\u0443\u0442\u0438: \u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\/\u0441\u043e\u0431\u044b\u0442\u0438\u0435(\u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u0435 \u043e \u043f\u0440\u0438\u0435\u043c\u0435)\/\u0432\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435:(\u041f\u0435\u0440\u0435\u0434\u0430\u0442\u043e\u0447\u043d\u044b\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442 (\u0442\u0438\u0442\u0443\u043b \u043f\u043e\u043a\u0443\u043f\u0430\u0442\u0435\u043b\u044f))\/\u041f\u043e\u0434\u043f\u0438\u0441\u044c\/\u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\/\u0424\u0418\u041e. \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u044d\u0442\u043e \u0447\u0435\u0440\u0435\u0437 \u043c\u0435\u0442\u043e\u0434 \u0421\u0411\u0418\u0421.\u041f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442<\/p>\n<pre><code class=\"powershell\">$urlnofinish=\"E:\\Scripts\\ChekSign\\nofinishsbis.xlsx\"   #\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043c\u0430\u0441\u0441\u0438\u0432\u044b \u043a\u0443\u0434\u0430 \u0431\u0443\u0434\u0435\u043c \u0437\u0430\u043d\u043e\u0441\u0438\u0442\u044c \u043d\u043e\u043c\u0435\u0440\u0430 \u0438 \u0441\u0442\u0430\u0442\u0443\u0441\u044b \u0442\u0435\u0445 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435 \u043f\u0440\u043e\u0448\u043b\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443, \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e.  $arr_nofinish_id = @() $arr_nofinish_status = @()  $isfile = Test-Path $urlnofinish #\u0435\u0441\u043b\u0438 \u0444\u0430\u0439\u043b \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u043c \u0438\u0437 \u043d\u0435\u0433\u043e \u0434\u0430\u043d\u043d\u044b\u0435. if ($isfile){ $nofinish = Import-Excel -Path $urlnofinish foreach ($nf in $nofinish){   $JsonBodyNoFinish =  '{    \"jsonrpc\": \"2.0\",    \"method\": \"\u0421\u0411\u0418\u0421.\u041f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\",    \"params\": {       \"\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\": {          \"\u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\": \"'+$nf.\u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440+'\",          \"\u0414\u043e\u043f\u041f\u043e\u043b\u044f\": \"\u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435\u041f\u043e\u043b\u044f\"       }    },    \"id\": 0 }'     $ArrNames =  Invoke-RestMethod -Method Post -ContentType \"application\/json-rpc;charset=utf-8\" -Uri $urlquery -Body $JsonBodyNoFinish -Headers $headers  $inb = $ArrNames.result.\u0421\u043e\u0431\u044b\u0442\u0438\u0435 $i=0  if (($ArrNames.result.\u0421\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435.\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 -ne \"\u0412\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043e \u0443\u0441\u043f\u0435\u0448\u043d\u043e\")  -and ($ArrNames.result.\u0421\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435.\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 -ne \"\u0412\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043e \u0441 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430\u043c\u0438\")) { $arr_nofinish_id += $ArrNames.result.\u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 $arr_nofinish_status += $ArrNames.result.\u0421\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435.\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 } else {  foreach ($in in $inb){  if ($in.\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 -eq \"\u0423\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u0435 \u043e \u043f\u0440\u0438\u0435\u043c\u0435\"){ $tin = $in.\u0412\u043b\u043e\u0436\u0435\u043d\u0438\u0435.\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 $i=0 foreach ($t in $tin){ if ($t.Contains(\"\u0442\u0438\u0442\u0443\u043b\")){  foreach ($excel in $dataexcel) { $in.\u0412\u043b\u043e\u0436\u0435\u043d\u0438\u0435.\u041f\u043e\u0434\u043f\u0438\u0441\u044c.\u0421\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442.\u0418\u041d\u041d[$i] $in.\u0412\u043b\u043e\u0436\u0435\u043d\u0438\u0435.\u041f\u043e\u0434\u043f\u0438\u0441\u044c.\u0421\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442.\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435[$i] $in.\u0412\u043b\u043e\u0436\u0435\u043d\u0438\u0435.\u041f\u043e\u0434\u043f\u0438\u0441\u044c.\u0421\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442.\u0424\u0418\u041e[$i] $in.\u0412\u043b\u043e\u0436\u0435\u043d\u0438\u0435.\u041f\u043e\u0434\u043f\u0438\u0441\u044c.\u0421\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442.\u0414\u043e\u043b\u0436\u043d\u043e\u0441\u0442\u044c[$i]   if ($excel.\u0424\u0418\u041e -eq $in.\u0412\u043b\u043e\u0436\u0435\u043d\u0438\u0435.\u041f\u043e\u0434\u043f\u0438\u0441\u044c.\u0421\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442.\u0424\u0418\u041e[$i]) { $f = 1 if ($excel.\u0414\u0430\u0442\u0430 -eq $null){  } else { if($excel.\u0414\u043e\u0432\u0435\u0440\u0435\u043d\u043d\u043e\u0441\u0442\u044c -ne \"\u0423\u0441\u0442\u0430\u0432\"){ if ($date -gt $excel.\u0414\u0430\u0442\u0430_\u0438\u0441\u0442\u0435\u0447\u0435\u043d\u0438\u044f_\u0434\u043e\u0432\u0435\u0440\u0435\u043d\u043d\u043e\u0441\u0442\u0438){   if($arr_data_name -notcontains $in.\u0412\u043b\u043e\u0436\u0435\u043d\u0438\u0435.\u041f\u043e\u0434\u043f\u0438\u0441\u044c.\u0421\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442.\u0424\u0418\u041e[$i]) { $arr_data_name +=($in.\u0412\u043b\u043e\u0436\u0435\u043d\u0438\u0435.\u041f\u043e\u0434\u043f\u0438\u0441\u044c.\u0421\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442.\u0424\u0418\u041e[$i]) $arr_data_company +=($in.\u0412\u043b\u043e\u0436\u0435\u043d\u0438\u0435.\u041f\u043e\u0434\u043f\u0438\u0441\u044c.\u0421\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442.\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435[$i]) $arr_data_master +=($excel.\u041e\u0442\u0432\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439) $arr_data_email+=($excel.Email) $arr_data_position +=($excel.\u0414\u043e\u043b\u0436\u043d\u043e\u0441\u0442\u044c)  } } } } }  }  if ($f -eq 0 ){    if ( $arr_name -notcontains $in.\u0412\u043b\u043e\u0436\u0435\u043d\u0438\u0435.\u041f\u043e\u0434\u043f\u0438\u0441\u044c.\u0421\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442.\u0424\u0418\u041e[$i] ) {  $arr_name+=($in.\u0412\u043b\u043e\u0436\u0435\u043d\u0438\u0435.\u041f\u043e\u0434\u043f\u0438\u0441\u044c.\u0421\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442.\u0424\u0418\u041e[$i]) if ($in.\u0412\u043b\u043e\u0436\u0435\u043d\u0438\u0435.\u041f\u043e\u0434\u043f\u0438\u0441\u044c.\u0421\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442.\u0418\u041d\u041d[$i] -ne $null){ if ($in.\u0412\u043b\u043e\u0436\u0435\u043d\u0438\u0435.\u041f\u043e\u0434\u043f\u0438\u0441\u044c.\u0421\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442.\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435[$i] -ne \"\") { $arr_company+=($in.\u0412\u043b\u043e\u0436\u0435\u043d\u0438\u0435.\u041f\u043e\u0434\u043f\u0438\u0441\u044c.\u0421\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442.\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435[$i]) $arr_position+=($in.\u0412\u043b\u043e\u0436\u0435\u043d\u0438\u0435.\u041f\u043e\u0434\u043f\u0438\u0441\u044c.\u0421\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442.\u0414\u043e\u043b\u0436\u043d\u043e\u0441\u0442\u044c[$i]) }  if ($in.\u0412\u043b\u043e\u0436\u0435\u043d\u0438\u0435.\u041f\u043e\u0434\u043f\u0438\u0441\u044c.\u0421\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442.\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435[$i] -eq \"\"){ $arr_company+= ($in.\u0412\u043b\u043e\u0436\u0435\u043d\u0438\u0435.\u041f\u043e\u0434\u043f\u0438\u0441\u044c.\u0421\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442.\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435[$i]) $arr_position+=($in.\u0412\u043b\u043e\u0436\u0435\u043d\u0438\u0435.\u041f\u043e\u0434\u043f\u0438\u0441\u044c.\u0421\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442.\u0414\u043e\u043b\u0436\u043d\u043e\u0441\u0442\u044c[$i]) }  } else { $arr_company+=($in.\u0412\u043b\u043e\u0436\u0435\u043d\u0438\u0435.\u041f\u043e\u0434\u043f\u0438\u0441\u044c.\u0421\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442.\u0424\u0418\u041e[$i]) $arr_inn+=($in.\u0412\u043b\u043e\u0436\u0435\u043d\u0438\u0435.\u041f\u043e\u0434\u043f\u0438\u0441\u044c.\u0421\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442.\u0418\u041d\u041d[$i]) }  }  }  } $i++ } } }   }  else{ $Null | Export-Excel -Path $urlnofinish  -WorksheetName \"\u041b\u0438\u0441\u04421\"   -AutoSize   $book = Open-ExcelPackage -Path $urlnofinish $worksheet = $book.Workbook.Worksheets['\u041b\u0438\u0441\u04421']  $worksheet.Cells[1,1].Value = \"\u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\" $worksheet.Cells[1,2].Value = \"\u0421\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435\"  Close-ExcelPackage $book <\/code><\/pre>\n<p>4. \u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e \u043a\u0430\u043a \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u043b\u0438 \u0441\u0442\u0430\u0440\u044b\u0435 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u044b \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a \u0447\u0442\u0435\u043d\u0438\u044e \u043d\u043e\u0432\u044b\u0445. <\/p>\n<p>\u0421\u043f\u0435\u0440\u0432\u0430 \u043f\u043e\u043b\u0430\u0435\u043c \u0441\u043f\u0438\u0441\u043e\u043a \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432, \u0430 \u0434\u0430\u043b\u0435\u0435 \u043e\u0431\u0440\u0430\u0449\u0430\u0435\u043c\u0441\u044f \u043a \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0443 \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e. <\/p>\n<p>\u0421\u0440\u0430\u0437\u0443 \u0445\u043e\u0447\u0443 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c \u0447\u0442\u043e \u043f\u0440\u0438 \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0438 \u043a \u0441\u043f\u0438\u0441\u043a\u0443 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0447\u0442\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u043e\u0441\u0442\u0440\u0430\u043d\u0438\u0447\u043d\u043e, \u0438 \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 \u0432\u043b\u0430\u0437\u0438\u0442 \u043d\u0435 \u0431\u043e\u043b\u0435\u0435 200 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432.<\/p>\n<p>\u041f\u043e-\u044d\u0442\u043e\u043c\u0443 \u0447\u0438\u0442\u0430\u0435\u043c \u043f\u043e\u0441\u0442\u0440\u0430\u043d\u0438\u0447\u043d\u043e \u0438 \u0437\u0430\u043d\u043e\u0441\u0438\u043c \u0432\u0441\u0435 \u0432 \u043c\u0430\u0441\u0441\u0438\u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432.\u00a0 <\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e \u043a\u0430\u043a \u0432\u0441\u0435 \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u043b\u0438 \u0437\u0430\u043d\u043e\u0441\u0438\u043c \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u0442\u043e\u0432 \u0432 \u0440\u0435\u0435\u0441\u0442\u0440, \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u043d\u0435 \u0438\u0441\u0442\u0435\u043a\u043b\u0430 \u043b\u0438 \u0438\u0445 \u0434\u043e\u0432\u0435\u0440\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u0438 \u043e\u043f\u043e\u0432\u0435\u0449\u0430\u0435\u043c \u043e\u0431 \u044d\u0442\u043e\u043c \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u043b\u0438\u0446 \u0438 \u0438\u0445 \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u0435\u0439. \u0410 \u0442\u0430\u043a \u0436\u0435 \u043d\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u044b\u0435 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u044b \u0437\u0430\u043d\u043e\u0441\u0438\u043c \u0432 \u0440\u0435\u0435\u0441\u0442\u0440 \u043d\u0435\u043e\u043a\u043e\u043d\u0447\u0435\u043d\u043d\u044b\u0445. <\/p>\n<p>\u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 write \u2013 host $msg \u00a0\u044d\u0442\u043e \u043a\u0430\u043a \u0440\u0430\u0437 \u043e\u043f\u043e\u0432\u0435\u0449\u0435\u043d\u0438\u044f \u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e $msg \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0432 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0443 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u043f\u043e\u0447\u0442\u044b (\u0441\u043c \u043d\u0438\u0436\u0435) <\/p>\n<p>\u0422\u0430\u043a \u0436\u0435 \u0445\u043e\u0447\u0443 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c \u0435\u0441\u043b\u0438 \u0434\u043e\u043b\u0436\u043d\u043e\u0441\u0442\u044c \u0443 \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u0442\u0430 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440, \u0433\u0435\u043d \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440, \u043f\u0440\u0435\u0437\u0438\u0434\u0435\u043d\u0442 \u0442\u043e \u043d\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0434\u043e\u0432\u0435\u0440\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u0438\u0431\u043e \u043e\u043d\u0430 \u043d\u0435 \u043d\u0443\u0436\u043d\u0430. <\/p>\n<pre><code class=\"powershell\">$dStart = (((date).Day - 1).ToString() + \".\" + ((date).Month).ToString() + \".\" +((date).Year).ToString())   $dEnd = (((date).Day - 1).ToString() + \".\" + ((date).Month).ToString() + \".\" +((date).Year).ToString())   $flag = 0  $fl =0  $arr_name = @() $arr_company = @() $arr_inn = @() $arr_kpp = @() $arr_position = @()  $arr_data_name = @() $arr_data_company = @() $arr_data_master = @() $arr_data_email = @() $arr_data_position = @()  $s = $dStart $po= $dEnd     $JsonBodyQuery2 = '{     \"jsonrpc\": \"2.0\",    \"method\": \"\u0421\u0411\u0418\u0421.\u0421\u043f\u0438\u0441\u043e\u043a\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432\",    \"params\": {       \"\u0424\u0438\u043b\u044c\u0442\u0440\": {          \"\u0414\u0430\u0442\u0430\u0421\": \"'+$s+'\",  \"\u0414\u0430\u0442\u0430\u041f\u043e\": \"'+$po+'\",  \"\u041d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435\": \"\u0418\u0441\u0445\u043e\u0434\u044f\u0449\u0438\u0439\",          \"\u0422\u0438\u043f\": \"\u0414\u043e\u043a\u041e\u0442\u0433\u0440\u0418\u0441\u0445\",  \"\u041d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u044f\": {         \"\u0420\u0430\u0437\u043c\u0435\u0440\u0421\u0442\u0440\u0430\u043d\u0438\u0446\u044b\": \"'+$itempagecount+'\",         \"\u0421\u0442\u0440\u0430\u043d\u0438\u0446\u0430\" : \"'+$page+'\" }       }    },    \"id\": 0   }'   $i=0    #\u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u043f\u0438\u0441\u043e\u043a \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0438 \u043e\u0431\u0440\u0449\u0430\u0435\u043c\u0441\u044f \u043a \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u043f\u043e \u0430\u0439\u0434\u0438  $Docs =  Invoke-RestMethod -Method Post -ContentType \"application\/json-rpc;charset=utf-8\" -Uri $urlquery -Body $JsonBodyquery2 -Headers $headers   while ($flag -eq 0) {   $Ids = $Docs.result.\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442    foreach ($id in $Ids) {  $JsonBodyQuery4 =  '{    \"jsonrpc\": \"2.0\",    \"method\": \"\u0421\u0411\u0418\u0421.\u041f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\",    \"params\": {       \"\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\": {          \"\u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\": \"'+ $id.\u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440+ '\",          \"\u0414\u043e\u043f\u041f\u043e\u043b\u044f\": \"\u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435\u041f\u043e\u043b\u044f\"       }    },    \"id\": 0 }' #\u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u043f\u043e\u0434\u043f\u0438\u0441\u0438 if (($id.\u0421\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435.\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 -ne \"\u0412\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043e \u0443\u0441\u043f\u0435\u0448\u043d\u043e\")  -and ($id.\u0421\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435.\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 -ne \"\u0412\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043e \u0441 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430\u043c\u0438\")) { if ($arr_nofinish_id -notcontains $id.\u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440){ $arr_nofinish_id += $id.\u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 $arr_nofinish_status += $id.\u0421\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435.\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 } }  else {  $ArrNames =  Invoke-RestMethod -Method Post -ContentType \"application\/json-rpc;charset=utf-8\" -Uri $urlquery -Body $JsonBodyquery4 -Headers $headers  $inboxes =  $ArrNames.result.\u0421\u043e\u0431\u044b\u0442\u0438\u0435  foreach ( $inbox in $inboxes){   if ($inbox.\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 -eq \"\u0423\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u0435 \u043e \u043f\u0440\u0438\u0435\u043c\u0435\"   ){ $tinboxes = $inbox.\u0412\u043b\u043e\u0436\u0435\u043d\u0438\u0435.\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 $i=0  foreach ($tinbox in $tinboxes ){ if ($tinbox.Contains(\"\u0442\u0438\u0442\u0443\u043b\")){   if ($inbox.\u0412\u043b\u043e\u0436\u0435\u043d\u0438\u0435.\u041f\u043e\u0434\u043f\u0438\u0441\u044c.\u0421\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442.\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435.Count -eq 1) {  $invlpodsertnaz =<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-349013","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/349013","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=349013"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/349013\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=349013"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=349013"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=349013"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}