Jump to content
Sign in to follow this  

Auto Create Ad-HOC Network

Recommended Posts


Hey Guyz,

I installed Windows 8 Just now, i was using Ad-HOC network though i was not able reconnect to Ad-Hoc Network after the Restart, maybe Some Windows 8 issue. which means to recreate the network after a Restart.

Anyways, I made this Script or Snippet so that automatically it will create the Network on startup. Only thing you need to do is Complile it and paste the Location in Startup.

I know it has no special Coding. but its my first Example Script, and i felt like sharing.

besides, New Ideas and improvised versions are always Welcome

Here i am giving the code rather than the complied one.

By the Way i am a Newbie just started Scripting 2-3 months back. So Appologies if the Scripting has done badly.


This Script is made to Automatically Start a AD-HOC Network to connect your wifi Devices(like mobile) from your Wifi Laptop(s)

1. You need to share the Internet Connection of Desktop or laptop by going into Properties Thats all.
2. Put This Compiled Script in Start-up Folder.

There You Go.

Default SSID = Home and Password = 12345678

Enjoy. Hope you Guyz like it.


; Run a command prompt as the other user.
;Local $AdminCMD = RunAs($sUserName, @ComputerName, $sPassword, 2, "cmd.exe", "", @SW_HIDE)

$AdminCMD = Run("cmd.exe", @WindowsDir & "\system32", @SW_HIDE)

If $AdminCMD = 0 Then
MsgBox(0,"Error", "Something went Wrong while Creating Ad-HOC Network")

;Administrator: C:\Windows\SYSTEM32\cmd.exe

ControlSend("Administrator: C:\Windows\SYSTEM32\cmd.exe","","","netsh wlan set hostednetwork mode=allow ssid=Home key=12345678")
ControlSend("Administrator: C:\Windows\SYSTEM32\cmd.exe","","","{ENTER}")
ControlSend("Administrator: C:\Windows\SYSTEM32\cmd.exe","","","netsh wlan start hostednetwork")
ControlSend("Administrator: C:\Windows\SYSTEM32\cmd.exe","","","{ENTER}")
ControlSend("Administrator: C:\Windows\SYSTEM32\cmd.exe","","","Exit")
ControlSend("Administrator: C:\Windows\SYSTEM32\cmd.exe","","","{ENTER}")

Hope you Guyz enjoy (just because u want these small stuffs in your laptop to be auto setup)

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.