說明

重新命名電腦與它在 Active Directory 中的電腦帳戶。本範例範例指令檔必需在本機執行,且僅適用於 Windows XP 或 Windows .NET Server。

範例指令碼

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colComputers = objWMIService.ExecQuery _
    ("Select * from Win32_ComputerSystem")
For Each objComputer in colComputers
    err = ObjComputer.Rename("WebServer")
    Wscript.Echo err
Next

本「系統管理指令碼指南」為 Windows .NET Server Resource Kit 的一部份。 如果您需要更多資訊,請連絡 scripter@microsoft.com。

arrow
arrow
    全站熱搜

    莊子 發表在 痞客邦 留言(0) 人氣()