Sign in to follow this  
Followers 0
rockscena

Auto Create Ad-HOC Network

1 post in this topic

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.

#comments-start

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.
#Comments-End

#RequireAdmin


; 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)
Sleep(1000)

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

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


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

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  
Followers 0