{"id":61,"date":"2011-03-19T11:57:30","date_gmt":"2011-03-19T18:57:30","guid":{"rendered":"http:\/\/blog.gptnet.net\/?p=61"},"modified":"2012-12-27T08:03:14","modified_gmt":"2012-12-27T15:03:14","slug":"enterprise-wlan-profile-deployment-with-bat","status":"publish","type":"post","link":"https:\/\/blog.gptnet.net\/?p=61","title":{"rendered":"Enterprise WLAN profile deployment with .bat script"},"content":{"rendered":"<p>I will demonstrate how to mass deploy WLAN profiles with simple .bat scripts and wlan.exe utility from Microsoft. Active Directory GPO prior to 2003 native mode doesn&#8217;t give you the option to mass deploy WLAN profiles. Also if you don&#8217;t run AD infrastructure at all and want a simple script you will find this useful.<br \/>\nScript takes into account that some clients don&#8217;t have Wireless card and will skip them.<br \/>\n<!--more--><\/p>\n<p><strong>Deployment environment:<\/strong><br \/>\nAD Infrastructure &#8211; 2000 Native mode<br \/>\nClients: Windows XP SP3 (wlan.exe requires SP3, later versions such as Vista and 7 come with utility)<\/p>\n<p><strong>Step 1<\/strong><br \/>\nYou first need to configure a profile on one of the clients and than export it using wlan.exe utility. To export profile you need to run wlan.exe utility in command prompt.<br \/>\nFind GUID of your wireless adapter; issue this command: <strong>wlan.exe ei<\/strong><br \/>\n<em>Interface 0:<br \/>\n        GUID: 00045340-cf09-4c5b-8f27-1bc000000a9c<br \/>\n        Broadcom 4321AG 802.11a\/b\/g\/draft-n Wi-Fi Adapter<br \/>\n        State: &#8220;connected&#8221;<\/em><br \/>\nFind if the profile exists on this interface; issue this command: <strong>wlan gpl 00045340-cf09-4c5b-8f27-1bc000000a9c<\/strong> Please make sure &#8220;template&#8221; profile you configured is there.<br \/>\nNow we export it as a .xml file: <strong>wlan.exe gp 00045340-cf09-4c5b-8f27-1bc000000a9c &#8220;dd-wrt&#8221; C:\\templt.xml<\/strong><br \/>\nFinally, open exported file and remove first and last line:<br \/>\n<em>The return profile xml is:<br \/>\nCommand &#8220;gp&#8221; completed successfully.<\/em> <\/p>\n<p><strong>Step 2<\/strong><br \/>\nNow we will import this profile. Using 2 .bat scripts. First one checks if the client has wireless card and if it is true we copy required files to %temp% folder and executes 2nd script, which imports WLAN profile you created in step 1.<br \/>\nNote: wlan.exe utility doesn&#8217;t work properly if it runs from the network share, thus we have to copy to %temp% and call it from there.<\/p>\n<pre lang=\"DOS\" line=\"1\">\r\n@echo off\r\nrem Date: March 17, 2011\r\nrem Author: Naz Snidanko\r\nrem Description: checks for wifi adapt, copies files to temp dir and runs deployment script and cleans\r\nsetlocal ENABLEEXTENSIONS\r\nipconfig | findstr \"Wireless\"\r\nif %errorlevel% EQU 0 goto wifi\r\nif %errorlevel% EQU 1 goto nowifi\r\n:wifi\r\nmkdir %temp%\\WLAN\r\ncopy \"\\\\share.com\\NETLOGON\\WLAN\\*.*\" %temp%\\WLAN\r\ncall %temp%\\WLAN\\WLAN_exec.bat\r\nrmdir \/S \/Q %temp%\\WLAN\r\n:nowifi<\/pre>\n<p>And thats the script that will execute (it is called as WLAN_exec.bat from previous script)<\/p>\n<pre lang=\"DOS\" line=\"1\">@echo off\r\nrem Date: March 16, 2011\r\nrem Author: Naz Snidanko\r\nrem Description: Manual deployment of wireless profiles on Windows XP SP3\r\nsetlocal ENABLEEXTENSIONS\r\nset wifiprofile=\"profile.xml\"\r\nFor \/F \"skip=2 tokens=1,2\" %%A IN ('%temp%\\WLAN\\wlan.exe ei') Do If \"%%A\"==\"GUID:\" set Interface=%%B\r\n%temp%\\WLAN\\wlan.exe sp %Interface% %wifiprofile%<\/pre>\n<p><a href='http:\/\/blog.gptnet.net\/wp-content\/uploads\/2011\/03\/WLAN1.zip'>Download wlan.exe utility<\/a><\/p>\n<p>Hope it helps, cheers!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I will demonstrate how to mass deploy WLAN profiles with simple .bat scripts and wlan.exe utility from Microsoft. Active Directory GPO prior to 2003 native mode doesn&#8217;t give you the option to mass deploy WLAN profiles. Also if you don&#8217;t &hellip; <a href=\"https:\/\/blog.gptnet.net\/?p=61\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7,1],"tags":[8,9,17,19,18,20,16],"class_list":["post-61","post","type-post","status-publish","format-standard","hentry","category-bat","category-random-stuff","tag-bat-2","tag-bat-script","tag-wlan-deployment-script","tag-wlan-profile-export","tag-wlan-profile-import","tag-wlan-profile-windows-xp","tag-wlan-exe"],"_links":{"self":[{"href":"https:\/\/blog.gptnet.net\/index.php?rest_route=\/wp\/v2\/posts\/61","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.gptnet.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.gptnet.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.gptnet.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.gptnet.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=61"}],"version-history":[{"count":8,"href":"https:\/\/blog.gptnet.net\/index.php?rest_route=\/wp\/v2\/posts\/61\/revisions"}],"predecessor-version":[{"id":132,"href":"https:\/\/blog.gptnet.net\/index.php?rest_route=\/wp\/v2\/posts\/61\/revisions\/132"}],"wp:attachment":[{"href":"https:\/\/blog.gptnet.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=61"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.gptnet.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=61"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.gptnet.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=61"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}