{"id":2507,"date":"2010-07-15T22:19:26","date_gmt":"2010-07-15T18:19:26","guid":{"rendered":"http:\/\/msbro.ru\/?p=2507"},"modified":"2010-07-15T22:19:26","modified_gmt":"2010-07-15T18:19:26","slug":"skript-dlya-sozdaniya-na-rabochem-stole-yarlykov-podklyuchennykh-setevykh-diskov-i-rdp-podklyuchenijj","status":"publish","type":"post","link":"https:\/\/msbro.ru\/index.php\/archives\/2507","title":{"rendered":"\u0421\u043a\u0440\u0438\u043f\u0442 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043d\u0430 \u0440\u0430\u0431\u043e\u0447\u0435\u043c \u0441\u0442\u043e\u043b\u0435 \u044f\u0440\u043b\u044b\u043a\u043e\u0432 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u044b\u0445 \u0441\u0435\u0442\u0435\u0432\u044b\u0445 \u0434\u0438\u0441\u043a\u043e\u0432 \u0438 RDP-\u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439"},"content":{"rendered":"<pre><!--more-->\/\/ \u0421\u043a\u0440\u0438\u043f\u0442 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043d\u0430 \u0440\u0430\u0431\u043e\u0447\u0435\u043c \u0441\u0442\u043e\u043b\u0435 \u044f\u0440\u043b\u044b\u043a\u043e\u0432 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u044b\u0445 \u0441\u0435\u0442\u0435\u0432\u044b\u0445 \u0434\u0438\u0441\u043a\u043e\u0432 \u0438 RDP-\u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439\r\n\r\na=new ShortCutter();\r\n\r\n\/\/ \u0421\u043e\u0437\u0434\u0430\u0442\u044c RDP-\u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043d\u0430 \u0440\u0430\u0431\u043e\u0447\u0435\u043c \u0441\u0442\u043e\u043b\u0435, \u0432 \u043f\u043e\u043b\u043d\u043e\u044d\u043a\u0440\u0430\u043d\u043d\u043e\u043c \u0440\u0435\u0436\u0438\u043c\u0435, \u0441 \u0430\u0432\u0442\u043e\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435\u043c \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044f \u044d\u043a\u0440\u0430\u043d\u0430\r\n\/\/ \u0438 \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0443\u0447\u0435\u0442\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u044c\u044e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f.\r\na.createrdpfile(\"\u0422\u0435\u0440\u043c\u0438\u043d\u0430\u043b-\u0441\u0435\u0440\u0432\u0435\u0440 1\",true,\"auto\",\"auto\",\"tserver.avangard.local\");\r\n\r\n\/\/ \u0421\u043e\u0437\u0434\u0430\u0442\u044c RDP-\u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0432 \u043e\u043a\u043e\u043d\u043d\u043e\u043c \u0440\u0435\u0436\u0438\u043c\u0435 \u0441 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435\u043c 800x600\r\n\/\/ \u0441 \u0443\u0447\u0435\u0442\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u044c\u044e \"AVANGARD-P\\Operator1\"\r\na.createrdpfile(\"\u0422\u0435\u0440\u043c\u0438\u043d\u0430\u043b \u041f\u0435\u043d\u0437\u0430\",false,800,600,\"tserver-p.avangard-p.local\",\"AVANGARD-P\\\\Operator1\");\r\n\r\n\/\/ \u0421\u043e\u0437\u0434\u0430\u0442\u044c \u044f\u0440\u043b\u044b\u043a\u0438 \u0434\u043b\u044f \u0441\u0435\u0442\u0435\u0432\u044b\u0445 \u0434\u0438\u0441\u043a\u043e\u0432 \"M:\" \u0438 \"O:\" \u043d\u0430 \u0440\u0430\u0431\u043e\u0447\u0435\u043c \u0441\u0442\u043e\u043b\u0435\r\na.createshortcut(\"\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u044b \u0441\u0435\u0440\u0432\u0435\u04401\",\"M:\\\\\",\"C:\\\\WINDOWS\\\\system32\\\\SHELL32.dll\",9);\r\na.createshortcut(\"\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u044b \u0441\u0435\u0440\u0432\u0435\u04402\",\"O:\\\\\",\"C:\\\\WINDOWS\\\\system32\\\\SHELL32.dll\",9);\r\n\r\n\/\/====================\r\nfunction ShortCutter()\r\n{\r\nthis.createshortcut=createshortcut;\r\nthis.createrdpfile=createrdpfile;\r\nthis.WshShell=WScript.CreateObject(\"WScript.Shell\");\r\nthis.fso=new ActiveXObject(\"Scripting.FileSystemObject\");\r\nthis.WshNetwork = WScript.CreateObject(\"WScript.Network\");\r\nthis.user=this.WshNetwork.UserDomain + \"\\\\\" + this.WshNetwork.UserName;\r\nthis.QueryWMI=QueryWMI;\r\n\r\nfunction createshortcut(name,path,icondll,iconpos)\r\n{\r\nstrDesktop = this.WshShell.SpecialFolders(\"Desktop\");\r\nfp=strDesktop + \"\\\\\"+name+\".lnk\"\r\nif (this.fso.FileExists(fp))\r\n\treturn;\r\nvar oShellLink = this.WshShell.CreateShortcut(fp);\r\noShellLink.TargetPath = path;\r\noShellLink.WindowStyle = 1;\r\noShellLink.IconLocation = icondll+ \" , \"+iconpos;\r\noShellLink.Description = name;\r\noShellLink.WorkingDirectory = strDesktop;\r\noShellLink.Save();\r\n}\r\n\r\nfunction createrdpfile(name,fullscreen,resx,resy,server,user)\r\n{\r\nvar WQL=\"Select ScreenHeight,ScreenWidth from Win32_DesktopMonitor where Availability=3\";\r\nvar wbemFlagReturnImmediately = 0x10;\r\nvar wbemFlagForwardOnly = 0x20;\r\nvar compname, username, password;\r\nvar wmi_items;\r\nvar SWBemlocator = new ActiveXObject(\"WbemScripting.SWbemLocator\");\r\nvar objWMIService = SWBemlocator.ConnectServer(\"localhost\",\"\\\\root\\\\CIMV2\",\"\",\"\");\r\nvar wmi_items = objWMIService.ExecQuery(WQL,\"WQL\",wbemFlagReturnImmediately | wbemFlagForwardOnly);\r\nvar wmi_enum = new Enumerator(wmi_items);\r\nvar wmi_item = wmi_enum.item();\r\nif (resx==\"auto\") resx=wmi_item.ScreenWidth;\r\nif (resy==\"auto\") resy=wmi_item.ScreenHeight\r\nif (user == null) u=this.user; else u=user;\r\nif (fullscreen==true) sm=2; else sm=1;\r\nstrDesktop = this.WshShell.SpecialFolders(\"Desktop\");\r\nfp=strDesktop + \"\\\\\"+name+\".rdp\"\r\nif (!this.fso.FileExists(fp))\r\n{\r\nfo = this.fso.CreateTextFile(fp,true);\r\ns=\"screen mode id:i:1\\n\\\r\nsession bpp:i:16\\n\\\r\nwinposstr:s:0,0,0,0,\"+resx+\",\"+resy+\"\\n\\\r\ncompression:i:1\\n\\\r\nkeyboardhook:i:2\\n\\\r\ndisplayconnectionbar:i:1\\n\\\r\ndisable wallpaper:i:1\\n\\\r\ndisable full window drag:i:1\\n\\\r\nallow desktop composition:i:0\\n\\\r\nallow font smoothing:i:0\\n\\\r\ndisable menu anims:i:1\\n\\\r\ndisable themes:i:1\\n\\\r\ndisable cursor setting:i:0\\n\\\r\nbitmapcachepersistenable:i:1\\n\\\r\naudiomode:i:0\\n\\\r\nredirectprinters:i:1\\n\\\r\nredirectcomports:i:1\\n\\\r\nredirectsmartcards:i:1\\n\\\r\nredirectclipboard:i:1\\n\\\r\nredirectposdevices:i:0\\n\\\r\nautoreconnection enabled:i:1\\n\\\r\nauthentication level:i:0\\n\\\r\nprompt for credentials:i:0\\n\\\r\nnegotiate security layer:i:1\\n\\\r\nremoteapplicationmode:i:0\\n\\\r\nalternate shell:s:\\n\\\r\nshell working directory:s:\\n\\\r\ngatewayhostname:s:\\n\\\r\ngatewayusagemethod:i:4\\n\\\r\ngatewaycredentialssource:i:4\\n\\\r\ngatewayprofileusagemethod:i:0\\n\\\r\npromptcredentialonce:i:1\\n\\\r\ndrivestoredirect:s:\\n\"\r\ns=s+\"full address:s:\"+server+\r\n\"\\nusername:s:\"+u+\"\\ndesktopwidth:i:\"+resx+\r\n\"\\ndesktopheight:i:\"+resy+\"\\n\"+\r\n\"screen mode id:i:\"+sm+\"\\n\";\r\n fo.Write(s);\r\n fo.Close();\r\n}\r\ndelete wmi_enum;\r\ndelete fso;\r\ndelete SWBemlocator;\r\n}\r\n\r\n}\r\n<\/pre>\n<p>\u0441\u043a\u0430\u0447\u0430\u0442\u044c <a href=\"http:\/\/msbro.ru\/wp-content\/uploads\/2010\/05\/createshortcuts_129.zip\">createshortcuts_129<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10],"tags":[],"class_list":["post-2507","post","type-post","status-publish","format-standard","hentry","category-scripts"],"_links":{"self":[{"href":"https:\/\/msbro.ru\/index.php\/wp-json\/wp\/v2\/posts\/2507"}],"collection":[{"href":"https:\/\/msbro.ru\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/msbro.ru\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/msbro.ru\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/msbro.ru\/index.php\/wp-json\/wp\/v2\/comments?post=2507"}],"version-history":[{"count":0,"href":"https:\/\/msbro.ru\/index.php\/wp-json\/wp\/v2\/posts\/2507\/revisions"}],"wp:attachment":[{"href":"https:\/\/msbro.ru\/index.php\/wp-json\/wp\/v2\/media?parent=2507"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/msbro.ru\/index.php\/wp-json\/wp\/v2\/categories?post=2507"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/msbro.ru\/index.php\/wp-json\/wp\/v2\/tags?post=2507"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}<!-- WP Super Cache is installed but broken. The constant WPCACHEHOME must be set in the file wp-config.php and point at the WP Super Cache plugin directory. -->