Set objExcel = CreateObject("Excel.Application")
Set objWorkbook = objExcel.Workbooks.Open _
("E:\PCandUsers.xls")
objExcel.visible = True
objExcel.DisplayAlerts = False
intRow = 2
Do Until objExcel.Cells(intRow,1).Value = ""
On Error Resume Next
If NOT objExcel.Cells(intRow,4).Value = "OK" Then
strComputer = objExcel.Cells(intRow,1).Value
strObjUser = "WinNT://" & strComputer & "/ESPRIT,user"
Set objUser = GetObject(strObjUser)
If Err.Number = 0 Then
WScript.Echo Space(3) & strComputer & " is online. . ."
strPasswd = objExcel.Cells(intRow,2).Value
objUser.SetPassword strPasswd
objExcel.Cells(intRow,4).Value = "OK"
Else
WScript.Echo Space(3) & strComputer & " is not online. . ."
objExcel.Cells(intRow,4).Value = "NOK"
End If
End If
intRow = intRow + 1
Loop
objWorkbook.SaveAs "E:\LocalAdminPwd.xls"
objExcel.Quit
Set objWorkbook = Nothing
Set objExcel = Nothing
Bookmark this post:
|
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
![]() ![]() |
0 评论:
发表评论