' specify account to create
strAccount = "Serhat"
strPswd = "12345test"

' get local computer name
Set objNetwork = CreateObject("Wscript.Network")
strComputer = objNetwork.ComputerName

' check if local account already exists
intExists = 0
Set colAccounts = GetObject("WinNT://" & strComputer & "")
colAccounts.Filter = Array("user")
For Each objUser In colAccounts
    If objUser.Name = strAccount Then
     intExists = 1
  End If
Next

If intExists = 0 Then
   ' create local user
   Set colAccounts = GetObject("WinNT://" & strComputer & "")
   Set objUser = colAccounts.Create("user", strAccount)

   ' set pswd
   objUser.SetPassword strPswd
   objUser.SetInfo

   ' set pswd never expires
   Set objUser = GetObject("WinNT://" & strComputer & "/" & strAccount & ",User")
   objUserFlags = objUser.Get("UserFlags")
   objPasswordExpirationFlag = objUserFlags Or ADS_UF_DONT_EXPIRE_PASSWD
   objUser.Put "userFlags", objPasswordExpirationFlag
   objUser.SetInfo

   ' add to local admins group
   Set objGroup = GetObject("WinNT://" & strComputer & "/Administrators,group")
   Set objUser = GetObject("WinNT://" & strComputer & "/" & strAccount & ",user")
   objGroup.Add(objUser.ADsPath)
End If
