ObjOU
(1)
StrUserCN
(1)
Excel
(1)
StrClass
(1)
ObjCell
(1)
IntRow
(1)
OU
(1)
ProfilePath
(1)
Deleting users from an OU
Asked By Jerem
30-May-07 02:13 PM
When I run the following script, I get an error message: Line 2, Char 19,
Exprected end of statement.
Can anyone help me out please?
Set objOU =
GetObject("LDAP://ou=047UDiploma,ou=047USchool,ou=sectionU06,ou=User
Accounts,dc=student,dc=cssd,dc=ab,dc=ca")
objOU.Delete user cn=047-c110-01
objOU.Delete user cn=047-c110-02
objOU.Delete user cn=047-c110-03
objOU.Delete user cn=047-c110-04
objOU.Delete user cn=047-c110-05
objOU.Delete user cn=047-c110-06
objOU.Delete user cn=047-c110-07
objOU.Delete user cn=047-c110-08
objOU.Delete user cn=047-c110-09
objOU.Delete user cn=047-c110-10
objOU.Delete user cn=047-c110-11
Deleting users from an OU
Asked By Richard Mueller [MVP]
30-May-07 02:38 PM
The parameters of the Delete method need to be in quotes, separated by a
comma. The syntax should be:
objOU.Delete "user", "cn=047-c110-01"
--
Richard Mueller
Microsoft MVP Scripting and ADSI
Hilltop Lab - http://www.rlmueller.net
--
Thanks Richard. I tried your suggestion before posting but it didn't work.
Asked By Jeremy Schubert
30-May-07 07:46 PM

Thanks Richard. I tried your suggestion before posting but it didn't work.
But now it is. It's a long, sordid story...
I used Excel to masage together my user names and the paramters. Then I
realized I needed double quotation marks around the parameters. I was able
to use the replace function in Notepad to add most of the double quotes, but
I couldn't figure out how to 'say' add double quotes to the end of each line
(in Notepad). Word let me use ^p in the replace function so I could replace
^p with ^p". But then when I ran the script, the computer wouldn't
recongnize the double quotes produced by Word. So I finally figured out to
use the Word replace function to add ZZ to the end of each line. Then, in
Notepad, I was able to replace the ZZ with double quotes created by Notepad
and all worked well. Then I cursed and said to myself, "The accounts
already existed. Why didn't I just export them to a txt file instead of an
Excel file and massaging data from there!" Next time...
Deleting users from an OU
Asked By Richard Mueller [MVP]
30-May-07 08:08 PM
I'm not sure what your code looks like, but the Delete method parameters can
be variables with string values assigned. For example, I would expect code
similar to the following to work:
strClass = "user"
strUserCN = objCell(intRow, intCol).Value
objOU.Delete strClass, "cn=" & strUserCN
and, if objCell(intRow, intCol).Value is equal to "cn=047-c110-01", then you
could use:
objOU.Delete strClass, strUserCN
The reason the first version did not work is that without the quotes, the
interpreter decided that user and cn=047-c110-01 were both variable names
(with blank values). The important thing is that you got the program to
work.
Thank you again Richard.
Asked By Jeremy Schubert
30-May-07 08:53 PM
Thank you again Richard. Going on what you have here, if I wanted to add a
profile path to all users, I could do something like
strUserCN=objCell(intRow,2).Value
objUser.Put "profilePath", \\server\profile.man$
and just have it loop til it comes to an empty cell? (assuming I have the
values for CN in column 2)
Jeremy
end of statement. Can anyone help me out please? Set objOU = GetObject("LDAP: / / ou = 047UDiploma, ou = 047USchool, ou = sectionU06, ou = User Accounts, dc = student, dc = cssd, dc = ab, dc = ca") objOU.Delete user cn = 047-c110-01 objOU.Delete user cn = 047-c110-02 objOU.Delete user cn = 047-c110-03 objOU.Delete user cn = 047-c110-04 objOU.Delete user cn = 047-c110-05 objOU.Delete user cn = 047-c110-06 objOU.Delete user cn = 047-c110-07 objOU.Delete user cn = 047-c110-08 objOU.Delete user cn = 047-c110-09 objOU.Delete user cn
C++ / VB create Excel spreadsheet without loading Excel Greetings, I have a script which uses CreateObject("Excel.Application") to create a spreadsheet. This works fine on my machine since I have Excel loaded. I plan to move the script to a server & would like to avoid loading Excel on that machine. Is it not possible to just put which registers its application object. / Al You can install the Excel viewer to open, view, and print Excel workbooks, even if you don't have Excel installed. You can also copy data from Excel Viewer 2003 to another program. However, you cannot edit data create a new workbook. This download is a replacement for Excel Viewer 97 and all previous Excel Viewer versions. http: / / www
C++ / VB Scripting an Excel add-in Hi, I have a vbscript that gets and controls Excel via Excel's built-in objects. But now I want to use and functions from a plugin that's currently loaded in Excel. I tried the following: Set xl = CreateObject("Excel.Application") set wbAddin = xl.Workbooks("AddinName.xla") 'successfull! set ObjectFromWithinAddin done? Thanks. Robert Have you tried doing this from within Excel (using VBA) ? If it does not work there then it And I realized that the problem is mostly related to Excel. In a VBA project, You only have to set a link to the other VBA project. But in the excel.programming newsgroup I found that - without a link to the ask there how to access objects. . . Robert keywords: Scripting, an, Excel, add-in description: Hi, I have a vbscript that gets and controls Excel via Excel's built-in objects. But now I want
C++ / VB excel automation Hi, doing excel automation I am running into the problem that a maro inside some excel files can throw a 'Microsoft Visual Basic / Runtime error' messagebox happens in an automated process I want to prevent the excel-macro from sending message boxes, maybe something similar to the excel object attribute excel.DisplayAlerts = False. I have no access to the execl files processed, so I must handle either the behavior of the excel macro or use some kind of 'hit the button' function no guarantee the answers will be applicable to the questions) excel.DisplayAlerts = False does not supress error messageboxes. Absolutely agree that them as they are. Thanks for your comments, Wolf keywords: excel, automation description: Hi, doing excel automation I am running into the problem that a maro
C++ / VB How to check whether MS Excel is installed or not in the System Hi All, I which is used to store some report data to an Excel file (using Excel automation process). Before i store the data to excel file, i need to check whether MS Excel is installed in the system or not. if excel is not installed then i have to store the data to text file. So how do i check whether excel is installed or not using MFC programming? - - Thanks Ash Jings Since you will be using the Excel automation interface why not try to create the Excel object and if it fails you can assume you have ERROR_SUCCESS) { bRet = TRUE; RegCloseKey(hkey); } return bRet; } In case of Excel you would have to check for another key in the
C++ / VB Where is Excel.h? I am having a problem finding Excel.h. I understand the file is created when you follow to install C++6.0, just to get the files Excel.h and Excel.cpp? Any advice / suggestions would be appreciated. I see the 6.0. Thank you. Which knowledgebase article? AliR. he on Excel.h / cpp should be created for you when you import the excel library. These do not ship with VC / VS. - - Ajay It Thanks I will try that. The instructions say to select Excel.exe. I guess that is why there were so many a lot of them. But, there were no files named excel.h or excel.cpp. And I get about two hundred compile errors of documents and settings \ cconac \ my documents \ visual studio 2005 \ projects \ excel test3 \ excel test3 \ debug \ excel.tlh 1219 Error 2 error
C++ / VB switching between workbooks not allowed in Excel Hi, I am using a VB Script to show a Bar Graph in our GUI through excel workbook. The call I am using in VB Script to create Excel Object is: . . . set ExcelObject = GetObject("", "Excel.Application") . . . Its working well when there is no Excel instance previously. If there is an existing excel sheet already open (opened manually and unrelated to the GUI VB Script), the GUI's Excel is taking control of the Excel and I am unable to switch back to the Excel Sheet which is opened manually. I can only switch to the previously running Excel sheet only when I minimize the excel sheet in the
C++ / VB 2 questions about TreeView in VB in Excel I am making a macro to build / use a TreeView for structuring / viewing / editing the content in an Excel file (Excel 2003). Two questions I hope you experts out there may in use and thus unique? Jim VB isn't in Excel, VBA is. You should ask in an Excel VBA group. In VB you would: 1) check if the Fool me once. . ." Thanks, Bob! I have now moved to Excel. br Jim keywords: 2, questions, about, TreeView, in, VB, in, Excel description: I am making a macro to build / use a TreeView for structuring / viewing / editing the content in an Excel file (Excel 2003). Two questions I hope you experts