找回密码
 加入
搜索
楼主: wangsheng108

[原创] 为装机人员量身定做的“软件自动安装器”正式版1.42版

 火.. [复制链接]
发表于 2012-2-18 03:25:46 | 显示全部楼层
谢谢分享~~学习一下!
发表于 2012-2-23 16:11:07 | 显示全部楼层
谢谢楼主~一直用你的 ,大大节省了工作时间。
发表于 2012-2-23 23:41:43 | 显示全部楼层
很方便的软件,装机的好选择!谢谢啊
发表于 2012-2-24 12:55:46 | 显示全部楼层
看起来不错,有源码就省得我去写了。
发表于 2012-2-26 11:48:06 | 显示全部楼层
本帖最后由 ticket 于 2012-2-26 11:51 编辑

大无为的精神,在此双手合十,感谢了

http://www.autoitx.com/forum.php?mod=redirect&goto=findpost&ptid=12220&pid=126307&fromuid=7648784
发表于 2012-2-26 11:57:47 | 显示全部楼层
界面挺漂亮,下来研究研究
发表于 2012-9-11 00:31:01 | 显示全部楼层
貌似加入新功能了啊~
发表于 2012-9-11 00:31:07 | 显示全部楼层
貌似加入新功能了啊~
发表于 2012-10-10 00:12:39 | 显示全部楼层
AU3-实用脚本大全
AU3-实用脚本大全
得到适配器信息

$strComputer = "."
$objWMIService = ObjGet( _
"winmgmts:\" & $strComputer & "\root\cimv2")
$IPConfigSet= $objWMIService.ExecQuery ("Select IPAddress from Win32_NetworkAdapterConfiguration" _
& " where IPEnabled=TRUE")

For $IPConfig in $IPConfigSet
If Not $IPConfig.IPAddress Then
For $i=0 To UBound($IPConfig.IPAddress)
ConsoleWrite( $IPConfig.IPAddress( $i) & @CRLF )
Next
EndIf
Next

禁用网络连接

$strComputer = "."
$objWMIService = ObjGet("winmgmts:\" & $strComputer & "\root\cimv2")
$colNetCards = $objWMIService.ExecQuery _
("Select * From Win32_NetworkAdapterConfiguration " _
& "Where IPEnabled = True";)
For $objNetCard in $colNetCards
$objNetCard.ReleaseDHCPLease()
Next

进行磁盘整理

$strComputer = "."
$objWMIService = ObjGet("winmgmts:\" _
& $strComputer & "\root\cimv2")
$colVolumes = $objWMIService.ExecQuery ("Select * from Win32_Volume Where Name = 'K:\'")
For $objVolume in $colVolumes
$errResult = $objVolume.Defrag()
Next

检查磁盘的可用空间

$strComputer = "."
$objWMIService = ObjGet("winmgmts:" _
& "!\" _
& $strComputer & "\root\cimv2")
$colDisks = $objWMIService.ExecQuery _
("Select * from Win32_LogicalDisk")
For $objDisk in $colDisks
ConsoleWrite( "DeviceID: " & $objDisk.DeviceID & @CRLF )
ConsoleWrite( "Free Disk Space: " _
& $objDisk.FreeSpace & @CRLF )
Next

检查PCMCIA接口数量

$strComputer = "."
$objWMIService = ObjGet("winmgmts:\" & $strComputer & "\root\cimv2")
$colItems = $objWMIService.ExecQuery("Select * from Win32_PCMCIAController")

ConsoleWrite( "Number of PCMCIA slots: " _
& $colItems.Count)

检查系统信息处理器数目

$strComputer = "."
$objWMIService = ObjGet("winmgmts:" _
& "!\" _
& $strComputer & "\root\cimv2")
$colSettings = $objWMIService.ExecQuery _
("Select * from Win32_ComputerSystem")
For $objComputer in $colSettings
ConsoleWrite( "System Name: " & $objComputer.Name & @CRLF )
ConsoleWrite( "Number of Processors: " & _
$objComputer.NumberOfProcessors )
Next

查看可用的物理内存

$strComputer = "."

$objWMIService = ObjGet("winmgmts:" _
& "!\" _
& $strComputer & "\root\cimv2")

$colSettings = $objWMIService.ExecQuery _
("Select * from Win32_OperatingSystem")

For $objOperatingSystem in $colSettings
ConsoleWrite( "可用物理内存: " & _
$objOperatingSystem.FreePhysicalMemory )
Next

获取U盘盘符

$var = DriveGetDrive( "REMOVABLE" )
Dim $DriveNumber[2]
$i = 1
If NOT @error Then
     For $i = 1 to $var[0]
         $state = DriveStatus($var[$i])
         If $state = "READY"     Then     
             $DriveNumber[$i] = Asc($var[$i]) - 96
             $i += 1
             ReDim $DriveNumber[$i]
         EndIf
     Next
     $DriveNumber[0] = $i
     $var = 0
EndIf

For $i = 1 To $i
     MsgBox(0,"阁下的U盘:",$DriveNumber[$i])
Next

调用windows自带的格式化工具

;
;
Local $DriveNumber=3   ;A盘为0,B盘为1,C盘为2,D盘为3,依次类推……
Local $FormatOptions=1 ;1为快速格式化,0为完全格式化
DllCall("shell32.dll","int","SHFormatDrive","hwnd",0,"int",$DriveNumber,"int",0,"int",$FormatOptions)
;
;

枚举文件

_filelist("F:\movie")

Func _filelist($searchdir)                           ;;;函数名(形参)
$search = FileFindFirstFile($searchdir & "\*.*")       ;;;;查找c:根目下的文件
If $search = -1 Then return -1                   ;;;;如果找不到,返回值 -1
While 1
     $file = FileFindNextFile($search)         ;;;查找下一个文件
     If @error Then                                         ;;;如果找不到文件

         FileClose($search)                             ;;;则关闭此句柄
         return                                                   ;;;返回
     Elseif   $file = "."   or $file = ".." Then     ;;如果找到的文件名为.或..则 ContinueLoop
         ContinueLoop                                     ;;;在某些版本的AU3里面可以不需要上行和这行。
     ElseIf stringinstr(FileGetAttrib($searchdir & "\" & $file),"D") then         ;;如果找到的是一个文件夹,则
         _filelist($searchdir & "\" & $file)     ;;递归调用filelist函数,并传参数   "$searchdir & "\" & $file"

     EndIf                                                           ;;;$file为查找到的文件夹名称,上一行意思就是进入此文件夹继续查找文件.如此循环
     ConsoleWrite( $searchdir & "\" & $file & @crlf )
WEnd
EndFunc

返回字符串的字节数

$var = "AutoIt 中文论坛"

MsgBox(64, "文本长度", "是:" & ChrLenFixed($var))

Func ChrLenFixed($c)
     Dim $ChrL = 0, $AscNum
     For $i = 1 To StringLen($c)
         $AscNum = AscW(StringMid($c, $i, 1))
         If $AscNum < 0 Then $AscNum = $AscNum + 65536
         If $AscNum > 255 Then
             $ChrL = $ChrL + 2
         Else
             $ChrL = $ChrL + 1
         EndIf
     Next
     Return $ChrL
EndFunc

列出A-Z

For $i=65 To 90
     MsgBox(0,"",chr($i))
Next


检查驱动器的文件系统类型

$strComputer = "."
$objWMIService = ObjGet("winmgmts:" _
& "!\" _
& $strComputer & "\root\cimv2")
$colDisks = $objWMIService.ExecQuery _
("Select * from Win32_LogicalDisk")
For $objDisk in $colDisks
ConsoleWrite( "DeviceID: " & $objDisk.DeviceID & @CRLF )
ConsoleWrite( "File System: " _
& $objDisk.FileSystem & @CRLF )
Next

检查软驱里是否有软盘

$strComputer = "."
$objWMIService = ObjGet( _
"winmgmts:\" & $strComputer & "\root\cimv2")
$colItems = $objWMIService.ExecQuery _
("Select * From Win32_LogicalDisk Where DeviceID = 'A:'")

For $objItem in $colItems
$intFreeSpace = $objItem.FreeSpace
If $intFreeSpace = "" Then
ConsoleWrite( "There is no disk in the floppy drive." & @CRLF )
Else
ConsoleWrite( "There is a disk in the floppy drive." & @CRLF )
EndIf
Next

判断磁盘是否为可移动驱动器

$strComputer = "."
$objWMIService = ObjGet("winmgmts:" _
& "!\" _
& $strComputer & "\root\cimv2")
$colDisks = $objWMIService.ExecQuery _
("Select * from Win32_LogicalDisk")
For $objDisk in $colDisks
ConsoleWrite( "DeviceID: "& @Tab _
& $objDisk.DeviceID & @CRLF )
Switch $objDisk.DriveType
Case 1
ConsoleWrite( "No root directory. " _
& "Drive type could not be " _
& "determined." & @CRLF )
Case 2
ConsoleWrite( "DriveType: "& @Tab _
& "Removable drive." & @CRLF )
Case 3
ConsoleWrite( "DriveType: "& @Tab _
& "Local hard disk." & @CRLF )
Case 4
ConsoleWrite( "DriveType: "& @Tab _
& "Network disk." & @CRLF )
Case 5
ConsoleWrite( "DriveType: "& @Tab _
& "Compact disk." & @CRLF )
Case 6
ConsoleWrite( "DriveType: "& @Tab _
& "RAM disk." & @CRLF )
Case Else
ConsoleWrite( "Drive type could not be" _
& " determined." & @CRLF )
EndSwitch
Next

列出每个用户所占用的磁盘空间

$strComputer = "."
$objWMIService = ObjGet("winmgmts:" _
& "!\" _
& $strComputer & "\root\cimv2")
$colQuotas = $objWMIService.ExecQuery _
("Select * from Win32_DiskQuota")
For $objQuota in $colQuotas
ConsoleWrite( "Volume: "& @Tab _
& $objQuota.QuotaVolume & @CRLF )
ConsoleWrite( "User: "& @Tab & $objQuota.User & @CRLF )
ConsoleWrite( "Disk Space Used: " _
& @Tab & $objQuota.DiskSpaceUsed & @CRLF )
Next

列出每个进程所占用的内存

$strComputer = "."
$objWMIService = ObjGet("winmgmts:" _
& "!\" _
& $strComputer & "\root\cimv2")
$colProcesses = $objWMIService.ExecQuery _
("Select * from Win32_Process")
For $objProcess in $colProcesses
ConsoleWrite( "Process: " & $objProcess.Name & @CRLF )
$sngProcessTime = (String($objProcess.KernelModeTime) + _
String($objProcess.UserModeTime)) / 10000000
ConsoleWrite( "Processor Time: " & $sngProcessTime & @CRLF )
ConsoleWrite( "Process ID: " & $objProcess.ProcessID & @CRLF )
ConsoleWrite( "Working $Size: " _
& $objProcess.WorkingSetSize & @CRLF )
ConsoleWrite( "Page File Size: " _
& $objProcess.PageFileUsage & @CRLF)
ConsoleWrite( "Page Faults: " & $objProcess.PageFaults & @CRLF & @CRLF )
Next

修改进程的优先权

Const $ABOVE_NORMAL = 32768
$strComputer = "."
$objWMIService = ObjGet("winmgmts:" _
& "!\" _
& $strComputer & "\root\cimv2")
$colProcesses = $objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = 'Notepad.exe'")
For $objProcess in $colProcesses
$objProcess.SetPriority($ABOVE_NORMAL)
Next

检查系统同时运行了多少个au3脚本

$strComputer = "."
$objWMIService = ObjGet( _
"winmgmts:\" & $strComputer & "\root\CIMV2")
$colItems = $objWMIService.ExecQuery( _
"SELECT * FROM Win32_Process" & _
" WHERE Name = 'AutoIt3.exe'")
For $objItem in $colItems
ConsoleWrite( "-------------------------------------------" & @CRLF )
ConsoleWrite( "CommandLine: " & $objItem.CommandLine & @CRLF )
ConsoleWrite( "Name: " & $objItem.Name & @CRLF & @CRLF )
Next

检查开机自启动项

$strComputer = "."
$objWMIService = ObjGet("winmgmts:" _
& "!\" _
& $strComputer & "\root\cimv2")
$colStartupCommands = $objWMIService.ExecQuery _
("Select * from Win32_StartupCommand")
For $objStartupCommand in $colStartupCommands
ConsoleWrite( "Command: " & $objStartupCommand.Command & @CRLF _
& "Description: " & $objStartupCommand.Description & @CRLF _
& "Location: " & $objStartupCommand.Location & @CRLF _
& "Name: " & $objStartupCommand.Name & @CRLF _
& "SettingID: " & $objStartupCommand.SettingID & @CRLF _
& "User: " & $objStartupCommand.User & @CRLF & @CRLF )
Next

重启或关闭远程计算机

$strComputer = "atl-dc-01"
$objWMIService = ObjGet("winmgmts:" _
& "!\" & _
$strComputer & "\root\cimv2")
$colOperatingSystems = $objWMIService.ExecQuery _
("Select * from Win32_OperatingSystem")
For $objOperatingSystem in $colOperatingSystems
$ObjOperatingSystem.Shutdown(1)
Next

获取系统开机的时间

$strComputer = "."
$objWMIService = ObjGet("winmgmts:" _
& "!\" _
& $strComputer & "\root\cimv2")
$colOperatingSystems = $objWMIService.ExecQuery _
("Select * from Win32_OperatingSystem")

For $objOS in $colOperatingSystems
ConsoleWrite( $objOS.LastBootUpTime)
Next

获取屏幕分辨率

$strComputer = "."
$objWMIService = ObjGet("winmgmts:\" & $strComputer & "\root\cimv2")
$colItems = $objWMIService.ExecQuery( "Select * from Win32_DesktopMonitor")
For $objItem in $colItems
ConsoleWrite( "Screen Height: " _
& $objItem.ScreenHeight & @CRLF )
ConsoleWrite( "Screen Width: " _
& $objItem.ScreenWidth & @CRLF )
Next

检查屏幕保护是否需要密码

$strComputer = "."
$objWMIService = ObjGet("winmgmts:\" & $strComputer & "\root\cimv2")
$colItems = $objWMIService.ExecQuery("Select * from Win32_Desktop")
For $objItem in $colItems
ConsoleWrite( "Screen Saver Secure: " _
& $objItem.ScreenSaverSecure & @CRLF )
Next


判断系统是否启动在安全模式的网络状态下

$strComputer = "."
$objWMIService = ObjGet("winmgmts:" _
& "!\" _
& $strComputer & "\root\cimv2")
$colSettings = $objWMIService.ExecQuery _
("Select * from Win32_ComputerSystem")
For $objComputer in $colSettings
ConsoleWrite( "System Name: " _
& $objComputer.Name & @CRLF )
ConsoleWrite( "Registered owner: " _
& $objComputer.PrimaryOwnerName & @CRLF )
Next

列出全部的已安装的软件

$strComputer = "."
$objWMIService = ObjGet("winmgmts:" _
& "!\" _
& $strComputer & "\root\cimv2")
$colSoftware = $objWMIService.ExecQuery _
("Select * from Win32_Product")

For $objSoftware in $colSoftware
ConsoleWrite( "Name: " & $objSoftware.Name & @CRLF )
ConsoleWrite( "Version: " & $objSoftware.Version & @CRLF & @CRLF )
Next

卸载软件

$strComputer = "."
$objWMIService = ObjGet("winmgmts:" _
& "!\" _
& $strComputer & "\root\cimv2")
$colSoftware = $objWMIService.ExecQuery _
("Select * from Win32_Product " _
& "Where Name = 'Personnel database'")
For $objSoftware in $colSoftware
$objSoftware.Uninstall()
Next

列出所有鼠标的信息

.$strComputer = "."
$objWMIService = ObjGet( _
"winmgmts:\" & $strComputer & "\root\cimv2")
$colItems = $objWMIService.ExecQuery( _
"Select * from Win32_PointingDevice")
For $objItem in $colItems
ConsoleWrite( "Description: " & $objItem.Description & @CRLF )
ConsoleWrite( "Device ID: " & $objItem.DeviceID & @CRLF )
ConsoleWrite( "Device Interface: " _
& $objItem.DeviceInterface & @CRLF )
ConsoleWrite( "Double Speed Threshold: " _
& $objItem.DoubleSpeedThreshold & @CRLF )
ConsoleWrite( "Handedness: " & $objItem.Handedness & @CRLF )
ConsoleWrite( "Hardware Type: " & $objItem.HardwareType & @CRLF )
ConsoleWrite( "INF File Name: " & $objItem.InfFileName & @CRLF )
ConsoleWrite( "INF Section: " & $objItem.InfSection & @CRLF )
ConsoleWrite( "Manufacturer: " & $objItem.Manufacturer & @CRLF )
ConsoleWrite( "Name: " & $objItem.Name & @CRLF )
ConsoleWrite( "Number Of Buttons: " _
& $objItem.NumberOfButtons & @CRLF )
ConsoleWrite( "PNP Device ID: " & $objItem.PNPDeviceID & @CRLF )
ConsoleWrite( "Pointing Type: " & $objItem.PointingType & @CRLF )
ConsoleWrite( "Quad Speed Threshold: " _
& $objItem.QuadSpeedThreshold & @CRLF )
ConsoleWrite( "Resolution: " & $objItem.Resolution & @CRLF )
ConsoleWrite( "Sample Rate: " & $objItem.SampleRate & @CRLF )
ConsoleWrite( "Synch: " & $objItem.Synch & @CRLF & @CRLF )
Next

列出没有工作的硬件

$strComputer = "."
$objWMIService = ObjGet("winmgmts:\" & $strComputer & "\root\cimv2")
$colItems = $objWMIService.ExecQuery _
("Select * from Win32_PnPEntity " _
& "WHERE ConfigManagerErrorCode <> 0")

For $objItem in $colItems
ConsoleWrite( "Class GUID: " & $objItem.ClassGuid & @CRLF )
ConsoleWrite( "Description: " & $objItem.Description & @CRLF )
ConsoleWrite( "Device ID: " & $objItem.DeviceID & @CRLF )
ConsoleWrite( "Manufacturer: " & $objItem.Manufacturer & @CRLF )
ConsoleWrite( "Name: " & $objItem.Name & @CRLF )
ConsoleWrite( "PNP Device ID: " & $objItem.PNPDeviceID & @CRLF )
ConsoleWrite( "Service: " & $objItem.Service & @CRLF & @CRLF )
Next
发表于 2013-6-26 22:28:34 | 显示全部楼层
很实用。不过要是加新软件进去又要重新改。感觉琮是不太方便。希望可以解决
发表于 2013-8-13 11:29:41 | 显示全部楼层
这个好像不错啊
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-11-23 15:55 , Processed in 0.194570 second(s), 14 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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