Thanks to Boyan for help with this.
http://sql.dzone.com/news/querying-active-directory-thro
Integrating your application with Active Directory (or another LDAP based directory) is a common requirement in many business applications. Almost every language has a way to query LDAP but little known is the approach of integrating SQL Server with your LDAP controller. This quick article will guide you through setting up and using LDAP queries through SQL Server with Active Directory as the LDAP controller.
- In SQL server Management Studio, go to Server Objects, Linked Servers, and right click ADSI, go to Properties.
- Go to Security, Add mapping, Local Login - “Whatever you want” in my case schoolpostadmin, Then put the remote user that you want to run the login + password.
Now run this on the server you want use:
Code:
declare @linkedServerSql nvarchar(4000), | |
@linkedServerName varchar(100), | |
@localSqlUsername varchar(100), | |
@domainUsername varchar(100), | |
@domainUserPassword varchar(100) | |
| |
-- Set the local sql server user | |
set @localSqlUsername = 'sqlUser' | |
-- format can be 'domainName\userName' or 'userName@domainName' | |
set @domainUsername = 'domainName\userName' | |
set @domainUserPassword = 'domainUserPassword' | |
| |
set @linkedServerName = 'adsi' | |
| |
set @linkedServerSql = ' | |
exec sp_addlinkedserver | |
''' + @linkedServerName + ''', | |
'''', | |
''ADSDSOObject'', | |
'''' | |
| |
exec sp_addlinkedsrvlogin | |
''' + @linkedServerName + ''', | |
false, | |
''' + @localSqlUsername + ''', | |
''' + @domainUsername + ''', | |
''' + @domainUserPassword + '''' | |
| |
exec sp_executesql @linkedServerSql |
Now just write your query. Eg:
Code:
SELECT ad.company AS AccountCode, ad.mail AS Email1, ad.sAMAccountName AS name | |
FROM OPENQUERY(ADSI, 'SELECT mail, sAMAccountName, company FROM ''LDAP://OU=students,DC=school,DC=local'' WHERE objectCategory = ''Person'' AND objectClass = ''user'' ') AS ad | |
ORDER BY Email1 |
For some reason, scheduled tasks don’t run out of the box with Windows 2008 R2.
The main reason for me was that it needed to have the “start in” specified.
Listed below are some from forums I searched. Most shouldn’t be required, but probably number 2!
1) Make sure that the task is set to “configure for Windows Vista or Windows 2008″ on the first page of the task properties (under the “general” tab)
2) Make sure that the task is set to “start in” the folder that contains the batch file: open the task properties, click on the “actions” tab, click on the action and then the “edit” button at the bottom. In the “Edit Action” Window there is a field for “start in (optional)” that you set to the path to the batch file.
3) Make sure that the task is running as an account that has explicit “Full access” permissions to all these things: The .bat file itself, the folder containing the .bat file, and the target files/folders that are affected by the .bat script. Inherited permissions didn’t seem to work for me.
4) Make sure that the account running the task is a member of the local “administrators” group for this machine
5) Make sure that the task is set to “run whether logged on or not”
6) The Task should run successfully with expected output when you right-click on the task and select “run” If it does that then it will run successfully when you are logged off.
Remove Exchange 2007 Mailbox Role Fails with error : Object is read only because it was created by a future version of Exchange: 0.10 (14.0.100.0). Current supported version is 0.1 (8.0.535.0).
Tech StuffYou may receive an Error when Exchange 2010 is installed and you want to remove an Exchange 2007 Mailbox Role!
Mailbox Role Failed
Error:
Object is read only because it was created by a future version of Exchange: 0.10 (14.0.100.0). Current supported version is 0.1 (8.0.535.0).
A closer look at the ExchangeSetup.txt tells me something about the Offline Address book and Public Folder store:
[28/10/2009 21:37:05] [2] Checking whether the public folder database “MB\Public Folder Storage Group\Public Folder Database” has local replicas.
[28/10/2009 21:37:06] [2] Searching objects of type “OfflineAddressBook” with filter “(PublicFolderDatabase Equal MB\Public Folder Storage Group\Public Folder Database)", scope “SubTree” under the root “Delimon Organization".
[28/10/2009 21:37:06] [2] Previous operation run on domain controller ‘x.delimon.be’.
[28/10/2009 21:37:06] [2] [ERROR] Object is read only because it was created by a future version of Exchange: 0.10 (14.0.100.0). Current supported version is 0.1 (8.0.535.0).
Opening the Offline Addressbook settings with Exchange 2007 Management Console also spawns the same error and makes the configuration Read Only.
So lets remove the Exchange 2007 CAS Server from the AOB Distribution and disable Public Folder Distribution with the Exchange 2010 Management Console…
That did not change anything ![]()
So lets remove the Public Folder Database with ADSIEDIT.MSC
(Connect to the Configuration Container)
IMPORTANT : You must have moved all PF data to another server, this will destroy your PF Database.
(In my case all information was already moved)
Now that replication has finished you can see that the Public Folder DB is no longer available
So now let’s retry the uninstall…
That worked out great
You can see below that the Exchange 2007 Mailbox Server has been removed from the Exchange Configuration
Conclusion:
If you have a public folder on your mailbox server then the Uninstallation of Exchange 2007 Mailbox Server may fail if Exchange 2010 is already deployed.
My guess is that Microsoft will release an update installer/uninstaller that does not fail on the Offline Address book/Public Folder info that was upgraded to Exchange 2010 version information in AD
Using ADSIEDIT.MSC should not be considered a supported solution, this is only a workaround!
Thanks to Johan for this one - : http://www.proexchange.be/blogs/exchange2010/archive/2009/10/28/remove-exchange-2007-mailbox-role-fails-with-error-object-is-read-only-because-it-was-created-by-a-future-version-of-exchange-0-10-14-0-100-0-current-supported-version-is-0-1-8-0-535-0.aspx
When you try to uninstall Exchange Server 2007, the uninstall operation stops responding when it runs the task to remove Exchange files
Server Stuff, ExchangeWhen you try to uninstall Exchange Server 2007, the uninstall operation stops responding when it runs the task to remove Exchange files
SYMPTOMS
You start to uninstall Microsoft Exchange Server 2007 by using the Add or Remove Programs item in Control Panel. When you do this, the following tasks are completed successfully:
All server roles are removed.
The Exchange organization is removed.
However, the uninstall operation stops responding when it runs the task to remove Exchange files. Although the progress bar indicates that 100 percent of the task is completed, the operation does not continue to the next step.
Additionally, when you open Task Manager, the Powershell.exe process constantly displays 25 percent CPU usage.
CAUSE
This problem occurs because a custom action invokes the Powershell.exe process but never executes the action.
RESOLUTION
To resolve this problem, open Task Manager, and then end the Powershell.exe process. The Powershell.exe process will restart immediately and then complete the uninstall operation.
STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the “Applies to” section.
MORE INFORMATION
For more information about how to completely remove Exchange Server 2007, visit the following Microsoft Web site:
http://technet.microsoft.com/en-us/library/bb123893.aspx (http://technet.microsoft.com/en-us/library/bb123893.aspx)
Back to the top
When logged into OWA 2010 and viewing messages, you are given the arrows to move to the next message item or previous message item.
Located in the upper right of the message box. Many of our users found them grayed out and could not select.
We had done an upgrade from exchange 2007 to 2010 but that didn’t seem to matter as it was not a server problem - some could use them and some could not.
The solution to this was found in the OWA help feature!
The reason the “Previous Item” & “Next Item” buttons are grayed out is because you have the Conversation option selected for the items in that folder (Note: Conversation is selected, by default, for all folders, when your mailbox is upgraded to R4).
If you turn it off (i.e. uncheck the check box next to “Conversation” or found within the “Sort” area - I.e: sort by date, from, to, etc..), then the arrows will work again.
The way you turn it off is by clicking the dropdown next to where it says “Arrange by” and unchecking the check box next to the word “Conversation".
Recent comments