123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112'==========================================================================
' NAME: List_AD_SamAccounts.vbs
'
' COMMENT: Enumerates all SamAccounts with department and descriptions
'
'==========================================================================
Option Explicit...
Archive for the ‘Scripting’ Category
Add non-exchange address to Exchange 2007 Transport Rule via adsiedit
Posted by John Sorensen on August 19th, 2009
Exchange 2007 transport rules are very useful in most cases but I had issues once trying to set up a rule for emails sent from a APC battery unit to be forwarded to my cell phone via text message. But I would recieve an error when configuring the rule when attempting to add my cell number to as “CC” to the header. I ended up just editing the active directory configuration using adsiedit.
To do this I first created a transport rule as I normally would but instead of attempting to change...
Runs a script against multiple computers
Posted by John Sorensen on June 29th, 2009
This snippet runs a script against multiple computers taken from a text file. A big time saver.
123456789101112131415161718192021'Create a FileSystemObject
Set oFS = CreateObject("Scripting.FileSystemObject")
'Open a text file of computer names
'with one computer name per line
Set oTS = oFS.OpenTextFile("c:computers.txt")
'go through the text file
Do Until oTS.AtEndOfStream
'get the next computer name
'store it in variable sComputer
sComputer = oTS.ReadLine
'-----------------------------------
'...
Query Scheduled Tasks using Powershell
Posted by John Sorensen on June 29th, 2009
This is a slightly modified version of Aaron Dodd’s script. There are some known issues with this script and has not been tested in many environments.
To use this powershell script place the script, the config file, and a list as a cvs file with the servers to be queried all in the same directory.
Save below as QueryScheduledTasks.ps1:
1234567891011121314151617181920212223242526272829303132$Description="Generate CSV of scheduled tasks in the environment"
#------------------------------------------------------------------------------
#...
Script to check for new users or computers and email output
Posted by John Sorensen on June 29th, 2009
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165'==========================================================================
'
'
' NAME: ADAddedUsersNComputers.vbs
'
'...
Run a command via vbscript
Posted by John Sorensen on June 29th, 2009
123456789101112131415161718192021222324252627'==========================================================================
'
' NAME: runcommand.vbs
'
' AUTHOR: John Sorensen
'
' COMMENT:
'
'==========================================================================
strCommand = "ipconfig" 'This is where you place command
WScript.Echo "Running command: " & strCommand
WScript.Echo
set objShell = CreateObject("Wscript.Shell")
set objProc = objShell.Exec(strCommand)
Do
...
Password Generator VBScript
Posted by John Sorensen on June 29th, 2009
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194;'[]}{\|~`:
' The numbers...
Folder Report VbScript
Posted by John Sorensen on June 29th, 2009
1234567891011121314151617181920212223242526272829303132333435363738394041424344'************************************************************
' File: FolderReport.vbs
'
'************************************************************
strSource="c:\"
iGrandTotalCount=0
iGrandTotalSum=0
Set objFSO=CreateObject("Scripting.FileSystemObject")
Set objFolder=objFSO.GetFolder(strSource)
Call ProcessFiles(objFolder)
WScript.Echo "Total count = "...
Place cmd in context menu via vbscipt
Posted by John Sorensen on June 29th, 2009
This script place’s a “cmd prompt here” in the explorers context menu. This is a most for any one that uses the command often.
123456789'**************************************************************************
' File: CmdPromptExplorerMenu.vbs
'**************************************************************************
Dim WSHShell
Set WSHShell = WScript.CreateObject("WScript.Shell")
WSHShell.RegWrite "HKCR\Folder\Shell\MenuText\Command\", "cmd.exe...
Create shortcut VBScript
Posted by John Sorensen on June 29th, 2009
1234567891011121314151617181920212223'====================================================================
' NAME: <createAddRemoveShortCut.vbs>
'
' COMMENT: Key concepts are listed below:
'1. Uses wscript.shell to create shortcut on the desktop.
'2. The hard part was passing an argument to the target, which is not allowed
'3. in the target argument. You need to use the arguments property instead.
'====================================================================
Option Explicit
Dim objShell...


Posted in
Tags: