Tuesday, 13 March 2018

map drive script

This VBscript will map a drive using a subroutine. The script can be modified to map multiple drives using the subroutine. Can be useful as a login script. Tested on Windows 2000 through to Windows 10.


'==========================================================================
'MapDrive.vbs
'Created by Timothy Bourne
'http://www.imric.co.uk
'Last Modified: 11th November 2009
'==========================================================================
'This VBscript will map a drive using a subroutine. The script can be 
'modified to map multiple drives using the subroutine. Can be useful as a 
'login script.
'==========================================================================

Option Explicit
On Error Resume Next

Dim objNetwork, objPassword, objCheckDrive
Dim strLocalName, strRemoteName, strUser
Dim bUpdateProfile, bAlreadyConnected
Dim i

Set objNetwork = Wscript.CreateObject("WScript.Network")

'Create drive mapping for Z: (this section can be copied for multiple drives)
strLocalName = "Z:"
strRemoteName = "\\Server01\data"
strUser = objNetwork.UserName 'Will use the current logged in username.
bUpdateProfile = FALSE 'Drive mapping will not be perminant.
EnumDrives 'Runs the subroutine to connect drive Z:

WScript.Quit

'EnumDrives subroutine
Sub EnumDrives

bAlreadyConnected = FALSE
Set objCheckDrive = objNetwork.EnumNetworkDrives()

'Check if the drive is already connected or not.
For i = 0 To objCheckDrive.Count - 1 Step 2
If objCheckDrive.Item(i) = strLocalName Then bAlreadyConnected = True
Next 

If bAlreadyConnected = True then
    WScript.Echo VbCrLf & strLocalName & " drive is already connected. Disconnecting it..."
'If the drive letter already exists, disconnect it...
    objNetwork.RemoveNetworkDrive strLocalName 
'... then connect it to the specified path.
    objNetwork.MapNetworkDrive strLocalName, strRemoteName, bUpdateProfile, strUser
    WScript.Echo strLocalName & " drive was reconnected to successfully."
Else
'If the drive letter dosn't exist, connect it to the specified path.
    objNetwork.MapNetworkDrive strLocalName, strRemoteName, bUpdateProfile, strUser
    WScript.Echo strLocalName & " drive was connected successfully."
End If
End Sub

get group members script

This VBscript will export the members of the specified AD group and then save and  display in excel. Tested on Windows 10 and Windows 2008 functional domain.


'==========================================================================
'GetGroupMembers.vbs
'Created by Timothy Bourne
'http://www.imric.co.uk
'Last Modified: 27/07/2015
'==========================================================================
'This VBscript will export the members of the specified AD group and
'then save and  display in excel.
'==========================================================================

Option Explicit
'On Error Resume Next

Dim strGroup
Dim objFSO, objOutfile, objGroup, objMember, objShell

strGroup = InputBox("Please enter the group name:")

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objOutFile = objFSO.CreateTextFile(strGroup & ".csv")
Set objGroup = GetObject("LDAP://cn=" & strGroup & ",OU=Groups,OU=Site,DC=Domain,DC=Name")

objOutFile.WriteLine "Group Name: " & objGroup.SAMAccountName
objOutFile.WriteLine objGroup.Info
objOutFile.WriteLine "Members:"

For Each objMember in objGroup.Members
    objOutFile.WriteLine "," & objMember.cn
Next

WScript.Echo "Exported the group: "& strGroup

Set objShell = CreateObject("WScript.Shell")
objShell.run ("Excel" & " """ & strGroup & ".csv""")

Monday, 12 March 2018

change admin password script

This VB script will change the local administrator password of a computer remotely by hostname. Tested on Windows XP, 2003 & Vista.


'==========================================================================
'ChangeAdminPassword.vbs
'Created by Timothy Bourne
'http://www.imric.co.uk
'Last Modified: 10th October 2007
'==========================================================================
'This VBscript will change the local administrator password of a computer 
'remotely by hostname.
'==========================================================================

Option Explicit
Dim strComputer, strPassword
Dim objUser

'Set the password.
strPassword = "Pa$$w0rd."

'Input box for the user the enter the remote hostname.
strComputer = InputBox("Enter Computer name:", "Computer Name")

'Get the Administator user account and set the password.
Set objUser = GetObject("WinNT://" & strComputer & "/Administrator, user")
objUser.SetPassword(strPassword)
objUser.SetInfo

'Set the Administrator account as enabled.
objUser.AccountDisabled = False
objUser.SetInfo

'Echo out that the Administrator password is reset.
WScript.Echo "The administrator password on " & strComputer & " has been changed."

add printer script

This VBscript will add one or more printers by using a subroutine. Tested on Windows 2000, XP, Vista & 7.


'==========================================================================
'AddPrinter.vbs
'By Timothy Bourne
'http://www.imric.co.uk
'Last Modified: 24th January 2010
'==========================================================================
'This VBscript will add one or more printers by using a subroutine.
'==========================================================================

Option Explicit
On Error Resume Next

Dim strPrinterPath
Dim objNetwork

'Path of Printer
strPrinterPath = "\\ServerName\Printer1" 
AddPrinter
objNetwork.SetDefaultPrinter strPrinterPath 'Makes this printer the default.
WScript.Echo strPrinterPath & " was marked default."

strPrinterPath = "\\ServerName\Printer2"
AddPrinter

'Add a printer subroutine
Sub AddPrinter
 Set objNetwork = CreateObject("WScript.Network")
 objNetwork.AddWindowsPrinterConnection strPrinterPath
 WScript.Echo strPrinterPath & " was successfully mapped."
End Sub

imr3dm5 · The Boltbox

game : Quake III Arena
mod : OSP / CPMA
file download : N/A
file size : N/A
gameplay : FFA / 1v1 / 2v2
date of release : Maybe someday?

imr3dm4 · The Bad Place

game : Quake III Arena
mod : OSP / CPMA
file download : imr3dm4.zip
file size : 1,935KB
gameplay : FFA / 1v1 / 2v2
date of release : 13th November 2009
original level : DM4 for Quake by id Software
other info : There are two versions of this map included in the file. imr3dm4 with my new item layout and imr3dm4cl with a classic style item layout.

imr3dm3 · The Dark Zone

game : Quake III Arena
mod : OSP / CPMA
file download : imr3dm3.zip
file size : 658KB
gameplay : FFA / 1v1 / 2v2
date of release : 10th March 2002
original level : DM6 for Quake by id Software