Overclockers Australia Forums
OCAU News - Wiki - QuickLinks - Pix - Sponsors  

Go Back   Overclockers Australia Forums > Software Topics > Windows Operating Systems

Notices


Sign up for a free OCAU account and this ad will go away!
Search our forums with Google:
Reply
 
Thread Tools
Old 15th September 2009, 12:33 PM   #1
Toxicity11 Thread Starter
Member
 
Join Date: Oct 2007
Posts: 178
Default Server03 Script Help

Hey guys,
In need of a little help with a script i have created, and i want to add a little more error checking into it, i have an explore box to find a spreadsheet to take names etc from and put them into active directory but when i want to press cancel on my explore box it continues in the script, id prefer it it just jumped to the bottom of my case statement rather than go to the next step, and i cant for the life of me figure out how to make it do that. can anyone please help? Script follows;

Case 2
on error resume next
'Read Excel sheet
Set objDialog = CreateObject("SAFRCFileDlg.FileOpen")
objDialog.OpenFileOpenDlg
Set objExcel = CreateObject("Excel.Application") 'Initialise Excel
Set objWorkbook = objExcel.Workbooks.Open _
( objDialog.FileName ) ' Open file

intRow = 3 'Start at third row of spreadsheet

WhiOU = InputBox("Please enter which OU you would like to add the users to")
Do Until objExcel.Cells(intRow,1).Value = ""
Set objOU = GetObject("LDAP://ou=" & WhiOU & ",dc=tafe,dc=local") ' Define OU, domain
Set objUser = objOU.Create _
("User", "cn=" & objExcel.Cells(intRow, 2).Value)
objUser.sAMAccountName = objExcel.Cells(intRow, 1).Value
objUser.GivenName = objExcel.Cells(intRow, 3).Value
objUser.SN = objExcel.Cells(intRow, 4).Value
objUser.Department = objExcel.Cells(intRow, 6).value
objUser.SetInfo
objUser.AccountDisabled = FALSE
objUser.SetInfo
objUser.SetPassword objExcel.Cells(intRow, 5).value 'Set password to the data in column 5
'Set department to the data in column 6
intRow = intRow + 1 'Move to next row
if err.number then
wscript.Echo "Error creating users - Error in looped procedure."
err.Clear
wscript.Quit
End if
Loop
if err.number then
wscript.Echo "Error creating users."
err.Clear
End if
'Close spreadsheet handling
objExcel.Quit


Thanks guys
__________________
Main Rig - Intel Core 2 Quad Q6600 G0 @ 3.2GHz // Asus P5Q Premium // 4GB Corsair Dominators // Leadtek GTX260+ Extreme // Seasonic 700w Modular // NZXT Tempest Case // 2.4TB of storage
Selling RAM and P4 PC's - http://forums.overclockers.com.au/sh...d.php?t=806186
Toxicity11 is offline   Reply With Quote

Join OCAU to remove this ad!
Reply

Bookmarks

Tags
script, server, server03

Sign up for a free OCAU account and this ad will go away!

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +10. The time now is 11:55 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd. -
OCAU is not responsible for the content of individual messages posted by others.
Other content copyright Overclockers Australia.
OCAU is hosted by Internode!