Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


VB Script regedit, regexp, Class, mapdrive, add user

 
Logged in as: Guest
arrSession:exec spGetSession 2,16,59145
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> Post a VBScript >> VB Script regedit, regexp, Class, mapdrive, add user
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 VB Script regedit, regexp, Class, mapdrive, add user - 4/15/2008 6:55:41 AM   
  drawls

 

Posts: 4
Score: 0
Joined: 2/11/2008
Status: offline
I think these scripts are correct but I'm not sure about the last 2. Let me know if they are incorrect.

option explicit
dim x
set x = wscript.createobject("wscript.shell")
x.regwrite "HKLM\Software\Microsoft\CurrentDate", date()
msgbox "The Key is created."

--------------------------------------------------------------------------------------------------------------
option explicit
dim x
dim knum
dim count
on error resume next
set x = wscript.createobject("wscript.shell")
knum = x.regread("HKLM\SOFTWARE\Microsoft\MyNumber")
if Err = 0 then
count = knum
count = cint(count) + 1
x.regwrite "HKLM\SOFTWARE\Microsoft\MyNumber" , count
else
x.regwrite "HKLM\SOFTWARE\Microsoft\MyNumber" , "1"
end if

----------------------------------------------------------------------------------------------------
option explicit
dim objRegExp, result
set objRegExp = New RegExp
objRegExp.Pattern = "review3"
result = inputbox("Pls enter a string.")
if objRegExp.test(result) = "True" then
msgbox objRegExp.replace(result, "test3")
else
msgbox "review3 not found"
end if

-------------------------------------------------------------------------------------------------
option explicit
dim result, objDoctor
set objDoctor = new Doctor
result = inputbox("Pls enter a specialty")
objDoctor.Specialty = result
objDoctor.StateSpecialty

Class Doctor
Private strName
Public Property Let Specialty(strSpecialty)
strName = strSpecialty
End Property
Function StateSpecialty
msgbox "My Specialty is " & strName
End Function
End Class
---------------------------------------------------------------------------------------------
Option Explicit
On Error Resume Next
Dim objWshNet
Set objWshNet = WScript.CreateObject("WScript.Network")
MapNetworkDrive "q:", "\\****\courses\cpt257", "****\*****", "*****"
WScript.Quit()  'Terminate script execution
Sub MapNetworkDrive(DriveLetter, NetworkPath, user, password)
objWshNet.MapNetworkDrive DriveLetter, NetworkPath,,user,password

End Sub
---------------------------------------------------------------------------------------------------
Option Explicit
On Error Resume Next
Dim objFsoObject, objWshShl, strNewAccts, strAcctName, strUser
strUser = inputbox("Enter a user.")
Set objFsoObject = CreateObject("Scripting.FileSystemObject")
Set objWshShl = WScript.CreateObject("WScript.Shell")
Set strNewAccts = _
objFsoObject.OpenTextFile("c:\Temp\UserNames.txt", 1, "True")
CreateNewAccts() 
WScript.Quit()   
Sub CreateNewAccts()  'This procedures creates new accounts
Do while False = strNewAccts.AtEndOfStream
   strAcctName = strNewAccts.ReadLine()
if strAcctName = strUser then
msgbox "The user already exists."
else
   objWshShl.Run strUser & " " & strAcctName & " " & strAcctName & _
     " /add", 0
msgbox "The user has been added."
end if
  
Loop
strNewAccts.Close
End Sub
 
 
Post #: 1
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> Post a VBScript >> VB Script regedit, regexp, Class, mapdrive, add user Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts