View Single Post
Staro 10.04.2006., 09:34   #7
Cataphract
Premium
Moj komp
 
Cataphract's Avatar
 
Datum registracije: Dec 2004
Lokacija: Constantinopolis
Postovi: 1,002
Citiraj:
Autor refa
ma može, znam da može, ali mi na kraj pameti nije bilo da su windowsi kreirali taj account. I odmah nakon promjene s domene na workgrupu resetirao sam računalo i poslije nikako ući u windowse da provjerim stvari sa account-om...
Administrator account windowsi kreiraju odmah po instalaciji, ne kužim što je tu nejasno. :confused: password mu možeš podesiti ili ručno prilikom instalacije ili jednostavnom skriptom. dok je nisam našao lokalni administratori su imali 4 različite šifre pa sam morao pogađati. mrak stvar.

' This script can be used to change the password for local users on several NT workstations or
' NT servers. It requires that the the account used to submit this script has the rights to
' change local passwords (typically, a member of the Domain Admins group will have this right)
' The script requires Windows Scripting Host and ADSI installed on the computer used to run it.
' Both can be downloaded for free from Microsoft or other scripting sites.
' The script is using a list of computers as input file that has to be created by the admnistrator.
' The list of computers has to look something like:
'
' computer1
' computer2
' ...
'
' An example of computer list is shipped with this script (computers.txt).
' If for some reason, one of the computers could not be accessed by the script, it will be saved in
' another file for later submission
'
' The script will output a confirmation of the password change to the screen or a warning
' message if the computer could not be contacted. DO NOT double click on the script or use wscript
' to lunch it unless you want a confirmation of each password change to pop-up on the screen.
' Instead, use "cscript setpass.vbs" command.

' The names of the files, user id and new password have to be initialized (see below)

On Error Resume Next
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Dim fso, fsox, fx
Dim inputFile, outputFile, computerIndex, myComputer,myUser, usr, mDSPath

' set inputFile to match the name of the text file with the list of computers to be changed
' set outputFile to match the name of the text file that will contain the names of the
' computers that could not be accessed by the script (like powered off)
' later, this file can be used as inputFile to reissue the password change to the computers that
' were not available initially
' set myUser to the name of the local account that needs to have the password changed
' set newPassword to the new password for the user
inputFile = "computers.txt"
outputFile = "computers_na.txt"
myUser = "Administrator"
newPassword = "LOZINKA"

' Windows Scripting Host object are created for the two files used in this script
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile(inputFile, ForReading, True)
Set fsox = CreateObject("Scripting.FileSystemObject")
Set fx = fsox.OpenTextFile(outputFile, ForWriting, True)

' The following variable will be used to list the number of computers processed at
' any time
computerIndex = 1

' For each computer in the computer list....
Do While f.AtEndOfLine <> True
myComputer = f.ReadLine
' An ADSI object is linked to the local user for the current computer
mDSPath = "WinNT://" & myComputer & "/" & myUser & ",user"
Set usr = GetObject(mDSPath)
If Err Then
' If the connection is not successful (computer off line or user doesn't exist) an entry
' is made in the outputFile with the computer name....
fx.WriteLine(myComputer)
' Comment out the next line if no output on the screen is required
WScript.Echo CStr(computerIndex) & ". " & myComputer & " could not be contacted"
Err.Clear
Else
' If the connection is successful, the user password is set to the new one
' and a confirmation is displayed on the screen
usr.SetPassword newPassword
' Comment out the next line if no output on the screen is required
WScript.Echo CStr(computerIndex) & ".User: " & myComputer & "\" & myUser & ": password changed"
End If
' The index is incremented
computerIndex = computerIndex + 1
Loop
' All files are closed
f.Close
fx.Close


pejstaš u txt dokument i preimenuješ ga u nešto.vbs.
Cataphract je offline   Reply With Quote