Click here to Skip to main content
Licence CPOL
First Posted 29 Jul 2010
Views 133
Downloads 0
Bookmarked 0 times

Change Admin Password Workstation PC's with VBScript

By | 29 Jul 2010 | Article
Changing Administrator Password for all your PC's workstation. With wscript.exe for maintaining your work.

Introduction

Maintenance your network workstation PC's. Changing Administrator Password to all your PC's Workstation with just one click.

Background

I was work as Engineer DSI Project. Job desc to do is migration all pc's workstation. I have some problem when i have finish this project for reporting data. When i must have to get all the data from all workstation pc's my script can't run as i want it. Then to solve this problem is to changing all PC's workstation with the same remote pc i have use it. When administrator password is different my report can't work. Then i create this script for solving my problem. It's work for me :)

Using the code

Use this code, Check the algorithm you want if you want to modified it :

' file name "ChangeAdmnPass.vbs"
' Created By Yadi Acho
' Last Modified : Friday, July 30 2010
' My Website : http://yadiacho.com
'

On Error Resume Next
Const ForReading = 1
Set objDialog = CreateObject("SAFRCFileDlg.FileSave")
'opening dialog save windows
'Log data for client pc if the client on your network unreachable
objDialog.FileName = "LogDataAcho.txt"
objDialog.FileType = "Normal Text File (*.txt)"
intReturn = objDialog.OpenFileSaveDlg

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.CreateTextFile(objDialog.FileName)
' Reading your List IP on your workstation
' If cannot read the file change with your Path file to IP-List.acho
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile _
    ("IP-List.acho", ForReading)
    strNextLine = objTextFile.ReadAll
    arrComputers = Split(strNextLine, vbCrLf)
' Remove the block comments(REM) if you dont want use your text ip list
REM arrComputers = Array(_
REM "169.179.205.192",_
REM "169.179.204.112"_
REM )
For Each strComputer In arrComputers
   WScript.Echo
   WScript.Echo "=========================================="
   WScript.Echo "Computer: " & strComputer
   WScript.Echo "=========================================="
   ' Using achoping for checking your workstation pc
   Call achoping(strComputer)
   ' Set your password
   Set user = GetObject("WinNT://" & strComputer & "/Administrator,user")
   user.setpassword "Password_Here" 
   user.setinfo 

Next
Function achoping(compinya)
Set objPing = GetObject("winmgmts:{impersonationLevel=impersonate}")._
        ExecQuery("select * from Win32_PingStatus where address = '"_
            & compinya & "'")
    For Each objStatus in objPing
        If IsNull(objStatus.StatusCode) or objStatus.StatusCode<>0 Then 
            WScript.Echo("Computer " & compinya & " is not reachable!! Kena ngidupin deh!!")
            MsgBox "Computer IP : " & compinya & " Anjrit Mati!!Kena ngidupin deh!!Catet Tro.."
            objFile.WriteLine compinya
            
            Else
            If IsNull(objStatus.StatusCode) or objStatus.StatusCode<>1 Then
            	WScript.Echo("Computer " & compinya & " is Available!!") 
            End If
        End If
    Next
End Function

It's work fine for me.... If u have different password for target ip host you need to chang your pc's manualy as same as host do u want it to change..

Points of Interest

I think when my work is going simple and finish it as well. This is my enough satisfaction..

History

Use it for free....

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

acho123

Engineer
Altelindo QQ Citibank NA.
United States United States

Member

Follow on Twitter Follow on Twitter
Begining from work hard and then get the experience and move it into excellent education....

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
GeneralMy vote of 5 Pinmemberacho1237:55 14 Aug '10  
GeneralMy vote of 1 Pinmemberdigital man1:34 30 Jul '10  
GeneralRe: My vote of 1 Pinmemberacho1237:52 6 Aug '10  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web02 | 2.5.120528.1 | Last Updated 30 Jul 2010
Article Copyright 2010 by acho123
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid