找回密码
 加入
搜索
查看: 2745|回复: 4

[系统综合] 关于win98 网络共享问题---很是困扰

[复制链接]
发表于 2010-12-29 11:45:21 | 显示全部楼层 |阅读模式
大家帮忙看看,怎样在不重启电脑情况下,重启网络共享相关服务(win98不像 winxp 那样可以在dos命令下 使用 net stop /start 命令,,,我要其 net stop server  /net start server 命令)

经常出现win98 连接 win2003 server一开始连接正常,过段时间就无法访问的错误提示。
win2003 server  启用guest 用户,并在安全性 去除了 guest不能访问限制

有建议的请联系我qq:29006327  注明:autoit 论坛

谢谢拉
发表于 2010-12-29 14:56:06 | 显示全部楼层
还在用98?无法实验。
 楼主| 发表于 2010-12-29 15:15:34 | 显示全部楼层
回复 2# ahphsautoit

没有办法,,公司垃圾机台系统还是win98 阿,,还要导出数据到网络上,所以就出现以上问题了
发表于 2010-12-29 15:22:42 | 显示全部楼层
还有人用98系统!!
发表于 2010-12-29 17:27:07 | 显示全部楼层
#Region ;**** 参数创建于 ACNWrapper_GUI ****
#AutoIt3Wrapper_UseUpx=n
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <array.au3>
#include <GUIComboBox.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>
#Region ### START Koda GUI section ### Form=c:\documents and settings\administrator\桌面\form1.kxf
$Form1_1 = GUICreate("修改网卡地址", 455, 239, 231, 257)
;$Input6 = GUICtrlCreateInput("", 320, 136, 121, 24)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
;$input7 = GUICtrlCreateInput("", 320, 160, 121, 24)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Button1 = GUICtrlCreateButton("修改", 368, 208, 75, 25)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Label3 = GUICtrlCreateLabel("原ip:", 44, 16, 30, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Label4 = GUICtrlCreateLabel("原子网掩码:", 7, 40, 67, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Label5 = GUICtrlCreateLabel("原网关:", 31, 64, 43, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Label6 = GUICtrlCreateLabel("原DNS1:", 19, 88, 55, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Label7 = GUICtrlCreateLabel("原DNS2:", 19, 112, 55, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Label8 = GUICtrlCreateLabel("192.168.1.2                        ", 80, 16, 141, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Label9 = GUICtrlCreateLabel("255.255.255.0                   ", 80, 40, 140, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Label10 = GUICtrlCreateLabel("192.168.1.1                         ", 80, 64, 144, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Label11 = GUICtrlCreateLabel("218.6.200.139                    ", 80, 88, 143, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Label12 = GUICtrlCreateLabel("61.139.2.69                        ", 80, 112, 141, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Label13 = GUICtrlCreateLabel("修改后ip", 257, 16, 51, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Label14 = GUICtrlCreateLabel("修改后子网掩码", 220, 40, 88, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Label15 = GUICtrlCreateLabel("修改后网关", 244, 64, 64, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Label16 = GUICtrlCreateLabel("修改后DNS1", 232, 88, 76, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Label17 = GUICtrlCreateLabel("修改后DNS2", 232, 112, 76, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Input1 = GUICtrlCreateInput("", 320, 16, 121, 24)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Input2 = GUICtrlCreateInput("", 320, 40, 121, 24)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Input3 = GUICtrlCreateInput("", 320, 64, 121, 24)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Input4 = GUICtrlCreateInput("", 320, 88, 121, 24)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Input5 = GUICtrlCreateInput("", 320, 112, 121, 24)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Label18 = GUICtrlCreateLabel("实际地址:", 19, 136, 55, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Label19 = GUICtrlCreateLabel("FF-FF-FF-FF-FF-FF        ", 80, 136, 144, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Label20 = GUICtrlCreateLabel("计算机名:", 19, 160, 55, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Label21 = GUICtrlCreateLabel("name                                  ", 80, 160, 140, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Combo1 = GUICtrlCreateCombo("", 72, 208, 233, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
$Label22 = GUICtrlCreateLabel("可用网卡:", 19, 208, 55, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Label23 = GUICtrlCreateLabel("当前网卡:", 19, 184, 55, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Label24 = GUICtrlCreateLabel("net                                        ", 80, 184, 142, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
;Opt("GUIOnEventMode", 1)
Global $NetworkAdapterInfo[9][20]
$NetworkAdapterInfo = _NetworkAdapterInfo()
Global $lanid
$config = "config.ini"
Global $xxx=""
        For $i=1 To $NetworkAdapterInfo[0][0]
                $xxx= $xxx & $NetworkAdapterInfo[$i][2] _
                &","&$NetworkAdapterInfo[$i][3] _
                &","&$NetworkAdapterInfo[$i][10] _
                &","&$NetworkAdapterInfo[$i][4] _
                &","&$NetworkAdapterInfo[$i][11]&"|"
        Next 
                 $xxx1=$NetworkAdapterInfo[1][2] _
                &","&$NetworkAdapterInfo[1][3] _
                &","&$NetworkAdapterInfo[1][10] _
                &","&$NetworkAdapterInfo[1][4] _
                &","&$NetworkAdapterInfo[1][11]
        GUICtrlSetData($Combo1,$xxx,$xxx1)
                GUICtrlSetData($Label24,$NetworkAdapterInfo[1][3])
                GUICtrlSetData($Label19,$NetworkAdapterInfo[1][4])
        updata()

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
                Case $Button1
                         
                        _SetCmpNameAndIP($lanid[3],GUICtrlRead($Label21),GUICtrlRead($Input1),GUICtrlRead($Input2),GUICtrlRead($Input3),GUICtrlRead($Input4)&","&GUICtrlRead($Input5))
                   writeini()
                   _offandonline()
                Case $Combo1
                   updata()
   EndSwitch
   Sleep(20)
WEnd

Func writeini()
        If GUICtrlRead($Label8)=GUICtrlRead($Input1) And GUICtrlRead($Label9)=GUICtrlRead($Input2) And GUICtrlRead($Label10)=GUICtrlRead($Input3) And GUICtrlRead($Label11)=GUICtrlRead($Input4) And GUICtrlRead($Label12)=GUICtrlRead($Input5) Then Exit
        If Not FileExists($config) Then
        IniWrite($config,"配置","1",$lanid[3]&","&GUICtrlRead($Label21)&","&GUICtrlRead($Label8)&","&GUICtrlRead($Label9)&","&GUICtrlRead($Label10)&","&GUICtrlRead($Label11)&","&GUICtrlRead($Label12))
        IniWrite($config,"配置","2",$lanid[3]&","&GUICtrlRead($Label21)&","&GUICtrlRead($Input1)&","&GUICtrlRead($Input2)&","&GUICtrlRead($Input3)&","&GUICtrlRead($Input4)&","&GUICtrlRead($Input5))
        IniWrite($config,"网卡","1",$lanid[0]&","&$lanid[1]&","&$lanid[2]&","&$lanid[3]&","&$lanid[4])
        Else
        Global $temp=IniRead ( $config, "网卡","1","")
        If $temp="" Then 
        IniWrite($config,"配置","1",$lanid[3]&","&GUICtrlRead($Label21)&","&GUICtrlRead($Label8)&","&GUICtrlRead($Label9)&","&GUICtrlRead($Label10)&","&GUICtrlRead($Label11)&","&GUICtrlRead($Label12))
        IniWrite($config,"配置","2",$lanid[3]&","&GUICtrlRead($Label21)&","&GUICtrlRead($Input1)&","&GUICtrlRead($Input2)&","&GUICtrlRead($Input3)&","&GUICtrlRead($Input4)&","&GUICtrlRead($Input5))
        IniWrite($config,"网卡","1",$lanid[0]&","&$lanid[1]&","&$lanid[2]&","&$lanid[3]&","&$lanid[4])
        EndIf
        EndIf
EndFunc

Func updata();更新数据
                Dim $RedComBOX=GUICtrlRead($Combo1)
                Dim $lanid = StringSplit($RedComBOX,",")
                Dim $RadCPNam = _RadCPName($lanid[3])
                Dim $ComPuterName = $RadCPNam[0]
                Dim $ComputerIP = $RadCPNam[1]
                Dim $ComputerZW = $RadCPNam[2]
                Dim $ComputerWG = $RadCPNam[3]
                Dim $ComputerDNS = $RadCPNam[4]

                ;=============================================将网卡信息写入GUI
                        GUICtrlSetData($Label24,$lanid[2])
                        ;GUICtrlSetData($Label19,$lanid[4])
                        GUICtrlSetData($Label21,$ComPuterName)
                        GUICtrlSetData($Label8,$ComputerIP)
                        GUICtrlSetData($Label9,$ComputerZW)
                        GUICtrlSetData($Label10,$ComputerWG)
                        Local $dns=StringSplit($ComputerDNS,",")
                        If @error=0 Then
                        GUICtrlSetData($Label11,$dns[1])
                        GUICtrlSetData($Label12,$dns[2])
                        Else
                        GUICtrlSetData($Label11,$ComputerDNS)
                        GUICtrlSetData($Label12,"")
                        EndIf
                        GUICtrlSetData($Label19,$lanid[4])
                ;=============================================将网卡信息写入GUI
                                Dim $ip = StringSplit($ComputerIP,".",2)
                                $ip[0]=10
                                $ip[1]=80
                                $ip[2]=25
                                Dim $ComputerIPx = _ArrayToString($ip,".")
                                Dim $ComputerZWx = "255.255.255.0"
                                Dim $ComputerWGx = "10.80.25.1"
                                Dim $ComputerDNS1x = "10.80.1.5"
                                Dim $ComputerDNS2x = "10.80.1.7"
                        GUICtrlSetData($Input1,$ComputerIPx)
                        GUICtrlSetData($Input2,$ComputerZWx)
                        GUICtrlSetData($Input3,$ComputerWGx)
                        GUICtrlSetData($Input4,$ComputerDNS1x)
                        GUICtrlSetData($Input5,$ComputerDNS2x)
EndFunc



Func _NetworkAdapterInfo()
;======================================================
;
; 函数名称:        _NetworkAdapterInfo()
; 详细信息:        获取系统所有网卡信息
; 返回值说明:
; 以二维数组方式返回.例如 $info=_NetworkAdapterInfo()
; $info[0][0] 网卡数量
; $info[1][0] 第一块网卡的标志1
; $info[1][1] 第一块网卡的状态 
; 状态说明:7为网卡未插网线,2为网卡连接正常
; $info[1][2] 第一块网卡的网卡名称
; $info[1][3] 第一块网卡的连接名称
; $info[1][4] 第一块网卡的MAC地址
; $info[1][5] 第一块网卡的IP地址
; $info[1][6] 第一块网卡的默认网关
; $info[1][7] 第一块网卡的子网掩码
; $info[1][8] 第一块网卡的主DNS
; $info[1][9] 第一块网卡的次DNS
; $info[1][10] 第一块网卡的ID
; $info[1][11] 第一块网卡机器名
; 第二块网卡:
; $info[2][0] 第二块网卡的标志1
; $info[2][10] 第二块网卡的ID

; 其他网卡信息依次类推。。。
; 注意,此UDF不会获取已经禁用的网卡。
; 作者:      Sanhen (gxbeiliu@163.com)
; 网站: www.lunhui.net.cn  www.autoitx.com
;======================================================
    Local $colItem
    Local $objItem
    Local $colItems 
    Local $objItems
    Local $objWMIService 
    Local $Adapters[1][12]
    $Adapters[0][0] = 0
    $objWMIService = ObjGet("winmgmts:\\localhost\root\CIMV2")
    $colItem  = $objWMIService.ExecQuery("Select * FROM Win32_NetworkAdapter Where NetConnectionStatus =2", "WQL", 0x30)
    If IsObj($colItem) Then
        For $objItem In $colItem
            If $objItem.MACAddress = "00:00:00:00:00:00" Then ContinueLoop
            $Adapters[0][0] += 1
            ReDim $Adapters[UBound($Adapters) + 1][12]
            $Adapters[$Adapters[0][0]][0] += $Adapters[0][0]
            $Adapters[$Adapters[0][0]][1] = $objItem.NetConnectionStatus
            $Adapters[$Adapters[0][0]][2] = $objItem.Description
            $Adapters[$Adapters[0][0]][3] = $objItem.NetConnectionID
            $Adapters[$Adapters[0][0]][4] = $objItem.MACAddress 
                        $Adapters[$Adapters[0][0]][11] = $objItem.PNPDeviceID 
            $colItems  = $objWMIService.ExecQuery('Select * FROM Win32_NetworkAdapterConfiguration Where MACAddress = "'&$Adapters[$Adapters[0][0]][4]&'" And IPEnabled = True ' , "WQL", 0x30)                     
            If IsObj($colItems) Then
                For $objItems In $colItems
                    $Adapters[$Adapters[0][0]][5] = $objItems.IPAddress(0)
                    $Adapters[$Adapters[0][0]][6] = $objItems.DefaultIPGateway(0)
                    $Adapters[$Adapters[0][0]][7] = $objItems.IPSubnet(0)
                    $Adapters[$Adapters[0][0]][8] = $objItems.DNSServerSearchOrder(0)
                    $Adapters[$Adapters[0][0]][9] = $objItems.DNSServerSearchOrder(1)
                    $Adapters[$Adapters[0][0]][10] = $objItems.SettingID
                Next    
            EndIf
        Next
    EndIf
    
Return $Adapters
EndFunc ;_NetworkAdapterInfo()

Func _SetCmpNameAndIP($LanID,$strComputerName,$setIP,$setZW,$setWG,$setDNS) 
;======================================================
; 函数名称:       _SetCmpNameAndIP($AdapterID,$strComputerName,$setIP,$setZW,$setWG,$setDNS) 
; 详细信息:        修改机器IP,和机器名
; $AdapterID 网卡ID
; $strComputerName 计算机名
; $setIP 机器IP
; $setZW 子网掩码
; $setWG 默认网关
; $setDNS DNS
; 作者:      viplight (viplight@qq.com)
; QQ: 530417369
;======================================================
$SetKey1 = "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001"
$SetKey2 = "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet002"
$CtrlKey = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet"
$LanReg1 = $SetKey1 & "Services\Tcpip\Parameters\Interfaces" & $LanID
$LanReg2 = $SetKey2 & "Services\Tcpip\Parameters\Interfaces" & $LanID
$LanReg3 = $CtrlKey & "Services\Tcpip\Parameters\Interfaces" & $LanID
;通过注册表修改计算机名
RegWrite ($SetKey1 & "Services\Tcpip\Parameters", "NV Hostname", "REG_SZ", $strComputerName)
RegWrite ($SetKey1 & "Services\Tcpip\Parameters", "Hostname", "REG_SZ", $strComputerName)
RegWrite ($CtrlKey & "Control\ComputerName\ComputerName", "ComputerName", "REG_SZ", $strComputerName)
RegWrite ($CtrlKey & "Services\Tcpip\Parameters", "NV Hostname", "REG_SZ", $strComputerName)
RegWrite ($CtrlKey & "Services\Tcpip\Parameters", "Hostname", "REG_SZ", $strComputerName)
;▲通过注册表修改计算机名

;通过注册表修改IP 
RegWrite($LanReg1,"IPAddress","REG_MULTI_SZ",$setIP) 
RegWrite($LanReg2,"IPAddress","REG_MULTI_SZ",$setIP) 
RegWrite($LanReg3,"IPAddress","REG_MULTI_SZ",$setIP)
;▲通过注册表修改IP

;通过注册表修改子网掩码 
RegWrite($LanReg1,"SubnetMask","REG_MULTI_SZ",$setZW) 
RegWrite($LanReg2,"SubnetMask","REG_MULTI_SZ",$setZW) 
RegWrite($LanReg3,"SubnetMask","REG_MULTI_SZ",$setZW)
;▲通过注册表修改子网掩码 

;通过注册表修改网关
RegWrite($LanReg1,"DefaultGateway","REG_MULTI_SZ",$setWG) 
RegWrite($LanReg2,"DefaultGateway","REG_MULTI_SZ",$setWG) 
RegWrite($LanReg3,"DefaultGateway","REG_MULTI_SZ",$setWG)
;▲通过注册表修改网关

;通过注册表修改DNS 
RegWrite($LanReg1,"NameServer","REG_SZ",$setDNS) 
RegWrite($LanReg2,"NameServer","REG_SZ",$setDNS) 
RegWrite($LanReg3,"NameServer","REG_SZ",$setDNS)
;▲通过注册表修改DNS

;通过注册表网卡自动获取IP为固定获取IP
RegWrite($LanReg3,"EnableDHCP","REG_DWORD","0")
;▲通过注册表网卡自动获取IP为固定获取IP
EndFunc   ;==>_SetCmpNameAndIP 

Func _RadCPName($AdapterID)
;=============================================网卡ip地址信息获取
Local $info[6]
Dim $CtrlKey = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet"
Dim $LanReg = $CtrlKey & "Services\Tcpip\Parameters\Interfaces" & $AdapterID
                $Info[0] =  RegRead($CtrlKey & "Control\ComputerName\ComputerName", "ComputerName")
                $Info[1] = RegRead($LanReg,"IPAddress")
                $Info[2] = RegRead($LanReg,"SubnetMask")
                $Info[3] = RegRead($LanReg,"DefaultGateway")
                $Info[4] = RegRead($LanReg,"NameServer")
                $Info[5] = RegRead($CtrlKey & "Services\NwlnkIpx\Parameters","VirtualNetworkNumber")
Return $info
;=============================================网卡ip地址信息获取
EndFunc

Func _offandonline();开关网卡
         $ssfCONTROLS = 3 
        $sConnectionName = "本地连接"
        $sEnableVerb = "启用(&A)" 
        $sDisableVerb = "停用(&B)"
        $sDisableVerb2 = "禁用(&B)"
        $shellApp = ObjCreate("shell.application")
        $oControlPanel = $shellApp.Namespace($ssfCONTROLS) 
        $oNetConnections = "" 
        for $folderitem in $oControlPanel.items  
         
          if $folderitem.name = "网络连接" then     
                $oNetConnections = $folderitem.getfolder
        ExitLoop
           endif
        next
        if $oNetConnections ="" then  
          MsgBox(0,"","未找到网络连接文档夹")
           Exit
        endif
        $oLanConnection = ""
        for $folderitem in $oNetConnections.items    
                if StringLower($folderitem.name) = StringLower($sConnectionName) then  
                           $oLanConnection = $folderitem
                ExitLoop    
          endif 
        next 
        if $oLanConnection ="" then 
           Exit 
        endif 
        $bEnabled = true 

        for $verb in $oLanConnection.verbs  
                if $verb.name = $sDisableVerb then      
                $verb.DoIt 
                endif    
                If $verb.name = $sDisableVerb2 Then
                $verb.DoIt 
                endif   
        next 
        
        For $i=1 To 10 Step 1
                for $verb in $oLanConnection.verbs   
                        if $verb.name = $sEnableVerb then  
                        $verb.DoIt 
                        ExitLoop 2
                        endif    
                next 
                sleep(1000)  
        Next
sleep(2000)  
EndFunc
这是一个修改网卡IP的 代码 里面有重启网卡的指令 不过没在98 下试过 你也可以尝试下 通过硬件启用禁用网卡达到目的
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-11-21 22:45 , Processed in 0.080039 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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