Important Notice: On February 29th, this community was put into read-only mode. All existing posts will remain but customers are unable to add new posts or comment on existing. Please feel to join our Community Discord for any questions and discussions.

Using .bat file to deploy wireless profile .xml

Hey guys, firstly just like to say this forum has been a huge help and have been using PDQ Deploy/Inventory for a few months now. It's been great.  Now to my issue im hoping someone can help with. 

What im trying to do is use PDQ Deploy to deploy a batch file i wrote that firstly deletes a wireless profile and then re-adds said wireless network by pulling the profile from a .xml file. I've attached the bat file as a txt file, (modified the ssid name and file location).  I can run the bat file with out issue locally on any machine and it adds the profile correctly.  And deletes first if its already there.  Now when i use pdq to try and deploy the issue i'm having is that it doesn't add the profile.  PDQ pushes successfully but it doesn't add the profile.  I've tried a bunch of steps, i had the profile on the target computer pushed to it with PDQ and it deletes the profile (part 1 of the bat script) but doesn't re-add it.  I tried removing the delete portion of the bat file but nothing, doesn't add.  I'm sure im doing something wrong, i fully admit i have little knowledge of scripting.  

I'm stumped right now though, the bat file works locally which is a start for us but it would be awesome if we could use pdq to deploy it when needed.  If it helps i am using Pro mode of Deploy 2.3 release 3.  Sorry for the long rant, and appreciate it if you read through it.  I'd be happy to provide any more information that may be needed. Thanks all

 

 

 

 

 




Wifi2.txt
0

Comments

3 comments
Date Votes
  • Try logging on to the target computer with the same account that was used to deploy the package. Do you see the profile? If you do then this profile is user specific. In cases like this you will need to set this Step to run as the logged on user. You can do that in the Step's Options tab.

    RunStepAsUser.png

    0
  • Shane appreciate the quick reply.  I was logged in to the target machine with the same profile that's being used to deploy , mine in this case, but no luck.  I tried adding the run as logged anyway to try it out but no luck.  Still reads as a successful push to the target machine but no show.  I've attached the .xml for the wlan profile in .txt format in case it helps.  

    You did make me realize that the bat file was not working for other users though.  I logged in with another profile just to try it and it didn't work, i'm pretty sure it was because i had the bat file and the .xml it was using  in a private folder.  So i moved that to a public folder and tried it again with the other user profile and it added correctly.  .Bat file still runs correctly locally, with pdq, pdq successfully removes the profile but does not add it on either profile. I do have admin rights on all machines.  I'm gonna try it again tomorrow on a few different laptops just to try maybe it doesn't like this wireless adapter?  Thanks again.

    0
  • I had the same problem making it work on my network when I referenced where the .xml file was locally
    example of the .bat file that didn't work: netsh wlan add profile filename="C:\Users\Public\Documents\Admin Arsenal\PDQ Deploy\Repository\Secure Wireless Setup\Wireless Network Connection-Test_A.xml" user=all

    I had to use the UNC path:
    example of the .bat file that worked: netsh wlan add profile filename="\\your computername here\Users\Public\Documents\Admin Arsenal\PDQ Deploy\Repository\Secure Wireless Setup\Wireless Network Connection-Test_A.xml" user=all

    Adding the user=all makes sure the profile works no matter who logs in to the network

    0