找回密码
 加入
搜索
查看: 6370|回复: 22

请教:利用脚本添加无线配置问题

[复制链接]
发表于 2009-11-1 14:13:42 | 显示全部楼层 |阅读模式
大家好:
    想写个脚本,在300台笔记本上来添加一个无线网络的设置,请问这个脚本改如何完成,谢谢!
    (笔记本的系统是XP+SP2或WIN2000+SP4)
       (添加的信息范围: SSID ; 加密形式 ; 密钥)
     感谢大家帮助!
 楼主| 发表于 2009-11-1 17:34:06 | 显示全部楼层
请大家帮帮忙啊!感谢!
发表于 2009-11-1 21:24:24 | 显示全部楼层
搞点图上来,你想做成咋样的,我自己写了一个可以用的只是用在我工作上的软件,所以你要搞些图出来看一下才知道咋做
 楼主| 发表于 2009-11-2 13:19:45 | 显示全部楼层
在无线网络连接的属性中添加一个无线网络的 SSID, 网络验证,数据加密,网络密钥 这四项!
将这些信息写入脚本,发给客户。减少IT人员的重复工作,因为有300台笔记本!

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
发表于 2009-11-4 11:04:13 | 显示全部楼层
自动,,,,,,,,,,
发表于 2009-11-4 12:03:11 | 显示全部楼层
你那无线网络是不是另外还有个软件来控制的连那个图也发上来看看
 楼主| 发表于 2009-11-4 13:10:11 | 显示全部楼层
不是!就用这个WINDOWS自带的配置就行!
发表于 2009-11-4 14:01:26 | 显示全部楼层
你的是不是每次都是同样的SSID不会改啦
发表于 2009-11-4 14:03:15 | 显示全部楼层
可以直接在外面登录不一定要在你这图片里面设置啊
发表于 2009-11-4 16:09:31 | 显示全部楼层
我觉得你可以先明白怎么在一个文本框中填写字符和如何点击按钮
如果掌握这些基本操作,那就解决问题了  
而不是直接索取一个结果或脚本
发表于 2009-11-4 17:54:33 | 显示全部楼层
这个问题很有意思,将来有时间我琢磨做一个脚本出来。

http://novirs.yo2.cn/articles/%E ... 9C%AC%EF%BC%89.html

当然,这里也有一个用wmi的方法来解决的,你可以做下参考。
 楼主| 发表于 2009-11-4 18:29:05 | 显示全部楼层
可以直接在外面登录不一定要在你这图片里面设置啊
xz00311 发表于 2009-11-4 14:03


我明白你的意思:
如果那样从在外面的双击需要进入的无线网络,这样必定要告知对方密钥,这样一来便失去了密钥的意义,而且有300多台笔记本需要加入网络,这样的重复劳动太呆了,所以就是想把SSID等一些网络验证信息写好后邮件发给客户,双击之后便可加入这些信息,等客户进入此无线范围后自动连接!
发表于 2009-11-4 23:16:21 | 显示全部楼层
先从官方论坛上看,xp系统下已经有这样的一个脚本了,稍微测试了下发现管用。只是如果你用的系统是中文XP的话,需要把脚本里的英文名称改成中文。如“Wireless Network Connection Properties”改成”无线网络连接属性“。参考链接:http://www.autoitscript.com/forum/index.php?showtopic=90184

这个脚本的思路是用命令行方式打开控制面板里的网络连接,然后键盘发送“无线”,键盘发送“APPSKEY”windows属性健,键盘发送“属性”后,获取控件的ID后进行配置逐步输入。

另外,除了autoit的解决思路外,如果系统是vista以上,可以用netsh wlan命令来配置SSID。参考链接:http://news.newhua.com/news1/Ski ... K7FIKF04B0I8H2.html
 楼主| 发表于 2009-11-5 10:15:19 | 显示全部楼层
谢谢楼上帮助!我就是通过 vista的 netsh wlan 命令后才有了这个想法!!!

楼上您测试是这段吗:
;Assign variables
$ssid = ('Self Explanatory')
$auth = ('Authentication mode here')
$encrypt = ('Encryption style here')
$NetKey = ('And just what is your password?')

; Setting the advanced setting in Network Properties
Run(@ComSpec & " /c " & 'ncpa.cpl', "C:\WINDOWS\system32\dllcache", @SW_HIDE)

;Open the Network Connections dialog and activate the properties page of the Wireless Network Connection
WinWait ( 'Network Connections')
if NOT WinActive ( 'Network Connections') then
    WinActivate ( 'Network Connections')
endif
WinWaitActive ( 'Network Connections')
Send('wireless')
send ('{Appskey}')
send ( 'r' )

;Insure the Wireless Network Connection Properties page has focus and move to the appropriate tab
$hwnd = WinGetHandle('Wireless Network Connection Properties')
WinWait ( $hwnd, 'General' )
if NOT WinActive ( $hwnd, 'General' ) then
    WinActivate ( $hwnd, 'General' )
endif
WinWaitActive ($hwnd, 'General' )
Sleep(500)
ControlCommand($hwnd, 'General', 12320, 'TabRight', '')
Sleep(500)

;Insure the Wireless Networks tab has focus
WinWait ( $hwnd, 'Wireless Networks')
if NOT WinActive ( $hwnd, 'Wireless Networks') then
    WinActivate ( $hwnd, 'Wireless Networks')
endif
WinWaitActive ( $hwnd, 'Wireless Networks')
Sleep(500)

;Check to insure that Windows Wireless Zero Configuration is being used, then click on the Add button
If Not ControlCommand($hwnd, 'Wireless Networks', 7024, 'IsChecked','') Then
    ControlCommand( $hwnd, 'Wireless Networks', 7024, 'Check', '')
EndIf
ControlFocus($hwnd, 'Wireless Networks', 7033)
Sleep(500)
ControlClick($hwnd, 'Preferred networks', 'Button7')

;Input the Wireless network properties information and save it
$handle = WinGetHandle('Wireless network properties')
ControlSetText($handle, "Association", "Edit1", $ssid)
ControlCommand($handle, "Wireless network key", "ComboBox1", "SelectString", $auth)
ControlCommand($handle, "Wireless network key", "ComboBox2", "SelectString", $encrypt)
ControlSetText($handle, "Wireless network key", "Edit2", $Netkey)
ControlSetText($handle, "Wireless network key", "Edit3", $Netkey)
ControlClick($handle, "", "Button4")

;Close the Wireless Network Connection Properties window
If WinExists('Wireless Network Connection Properties') Then
    WinActivate('Wireless Network Connection Properties')
    ControlFocus('Wireless Network Connection Properties', "Wireless Networks", 1)
    ControlClick('Wireless Network Connection Properties', 'Wireless Networks', 1)
EndIf

;Close the Network Connections windows
WinActivate('Network Connections')
Send('!{F4}')
 楼主| 发表于 2009-11-5 10:17:15 | 显示全部楼层
谢谢楼上帮助!我就是通过 vista的 netsh wlan 命令后才有了这个想法!!!

楼上您测试是这段吗:
;Assign variables
$ssid = ('Self Explanatory')
$auth = ('Authentication mode here')
$encrypt = ('Encryption style here')
$NetKey = ('And just what is your password?')

; Setting the advanced setting in Network Properties
Run(@ComSpec & " /c " & 'ncpa.cpl', "C:\WINDOWS\system32\dllcache", @SW_HIDE)

;Open the Network Connections dialog and activate the properties page of the Wireless Network Connection
WinWait ( 'Network Connections')
if NOT WinActive ( 'Network Connections') then
    WinActivate ( 'Network Connections')
endif
WinWaitActive ( 'Network Connections')
Send('wireless')
send ('{Appskey}')
send ( 'r' )

;Insure the Wireless Network Connection Properties page has focus and move to the appropriate tab
$hwnd = WinGetHandle('Wireless Network Connection Properties')
WinWait ( $hwnd, 'General' )
if NOT WinActive ( $hwnd, 'General' ) then
    WinActivate ( $hwnd, 'General' )
endif
WinWaitActive ($hwnd, 'General' )
Sleep(500)
ControlCommand($hwnd, 'General', 12320, 'TabRight', '')
Sleep(500)

;Insure the Wireless Networks tab has focus
WinWait ( $hwnd, 'Wireless Networks')
if NOT WinActive ( $hwnd, 'Wireless Networks') then
    WinActivate ( $hwnd, 'Wireless Networks')
endif
WinWaitActive ( $hwnd, 'Wireless Networks')
Sleep(500)

;Check to insure that Windows Wireless Zero Configuration is being used, then click on the Add button
If Not ControlCommand($hwnd, 'Wireless Networks', 7024, 'IsChecked','') Then
    ControlCommand( $hwnd, 'Wireless Networks', 7024, 'Check', '')
EndIf
ControlFocus($hwnd, 'Wireless Networks', 7033)
Sleep(500)
ControlClick($hwnd, 'Preferred networks', 'Button7')

;Input the Wireless network properties information and save it
$handle = WinGetHandle('Wireless network properties')
ControlSetText($handle, "Association", "Edit1", $ssid)
ControlCommand($handle, "Wireless network key", "ComboBox1", "SelectString", $auth)
ControlCommand($handle, "Wireless network key", "ComboBox2", "SelectString", $encrypt)
ControlSetText($handle, "Wireless network key", "Edit2", $Netkey)
ControlSetText($handle, "Wireless network key", "Edit3", $Netkey)
ControlClick($handle, "", "Button4")

;Close the Wireless Network Connection Properties window
If WinExists('Wireless Network Connection Properties') Then
    WinActivate('Wireless Network Connection Properties')
    ControlFocus('Wireless Network Connection Properties', "Wireless Networks", 1)
    ControlClick('Wireless Network Connection Properties', 'Wireless Networks', 1)
EndIf

;Close the Network Connections windows
WinActivate('Network Connections')
Send('!{F4}')
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-11-23 02:58 , Processed in 0.114144 second(s), 24 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表