MsgBox(64,"工作名称是:",_ReadWorkGroup())
_RenWorkGroups("sanhen")
Func _ReadWorkGroup()
;================================
;用法:_ReadWorkGroup()
;注意:此函数需要WMI服务的支持。
;作者:Make By Sanhen
;================================
Local $strComputer,$objWMIService
Local $colItems,$ReturnValue
$strComputer = "localhost"
$objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2")
$colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_ComputerSystem", "WQL", 0x10+ 0x20)
For $objItem in $colItems
$ReturnValue=$objItem.Domain
Next
Return $ReturnValue
EndFunc
Func _RenWorkGroups($WorkGroup)
;================================
;用法:_RenWorkGroups(新的工作组名称)
;注意:此函数需要WMI服务的支持。
;作者:Make By Sanhen
;================================
Local $strComputer,$objWMIService
Local $colItems,$ReturnValue
$strComputer = "localhost"
$objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2")
$colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_ComputerSystem", "WQL", 0x10+ 0x20)
For $objItem in $colItems
$ReturnValue = $objItem .JoinDomainOrWorkGroup($WorkGroup)
Next
EndFunc
|