Showing posts with label VBScript. Show all posts
Showing posts with label VBScript. Show all posts

Change Admin Password

sNewPassword = "pass"

Set oWshNet = CreateObject("WScript.Network")
sComputer = oWshNet.ComputerName
sAdminName = GetAdministratorName

On Error Resume Next
Set oUser = GetObject("WinNT://" & sComputer & "/" & sAdminName & ",user")
oUser.SetPassword sNewPassword
oUser.SetInfo
On Error Goto 0
msgbox "done"

Function GetAdministratorName()

Dim sUserSID, oWshNetwork, oUserAccount

Set oWshNetwork = CreateObject("WScript.Network")
Set oUserAccounts = GetObject( _
"winmgmts://" & oWshNetwork.ComputerName & "/root/cimv2") _
.ExecQuery("Select Name, SID from Win32_UserAccount" _
& " WHERE Domain = '" & oWshNetwork.ComputerName & "'")

On Error Resume Next
For Each oUserAccount In oUserAccounts
If Left(oUserAccount.SID, 9) = "S-1-5-21-" And _
Right(oUserAccount.SID, 4) = "-500" Then
GetAdministratorName = oUserAccount.Name
Exit For
End if
Next
End Function

GetProcessInfo using WMI

Sub GetProcess()
  Set objWMI = GetObject("winmgmts:")
  Set instanzen = objWMI.InstancesOf("Win32_Process")
  'MakeTabH "Instance","CommandLine"
  For Each objInstance In instanzen
    'MakeTabD objInstance.Name , objInstance.CommandLine
  write objInstance.Name  & " : " & objInstance.CommandLine & ""
  'document.frames.myiframe.document.body.style.font="arial"
  Next
End Sub

Send mail using smtp server(google,yahoo)

'send mail using CDO
Dim lobj_cdomsg
Set lobj_cdomsg = CreateObject("CDO.Message")
'With lobj_cdomsg.Configuration
lobj_cdomsg.Configuration.Fields(cdoSMTPServer) = "smtp.gmail.com"
'smtp.mail.yahoo.com
'smtp.mail.com

Send mail using VBScript(outlook)


    Set olApp = CreateObject("Outlook.Application") 
    Set olNS = olApp.GetNamespace("MAPI") 

Drive Space Information



Dim sms,DRVNM,FSO,tlin,blin
Set FSO = CreateObject("Scripting.FileSystemObject")
 tlin=chr(13) & "." & chr(13)
 blin= "========================================" & chr(13)

Silent Runners -- find out what starts up with Windows


'Silent Runners.vbs -- find out what starts up with Windows!
'(compatible with Windows 95/98/Millennium/NT 4.0/2000 Pro/XP Home & Pro/Vista)
'

Make you Xp Talk

Open a text file in notepad and write:

;copy from here--------------

Dim msg, sapi
msg=InputBox("Enter your text","Talk it")
Set sapi=CreateObject("sapi.spvoice")
sapi.Speak msg

;----------to here


( ';')< " Save the file with a (*.vbs) extension, it will create a VBScript File.
It will prompt you for a text, input the text and press ok."