Sunday 14 October 2012

Get-Mailbox Filtered via Group Membership

To display the mailboxes that are a member of a particular group


$gp = $(Get-Group "GroupName").Identity.DistinguishedName

Get-Mailbox -Filter{(memberofgroup -eq $gp)}

Thursday 4 October 2012

Global Address List --> How do I see the recipient filter

This is really basic powershell rather than exchange specific.

But we needed to troubleshoot why a specific mailbox was not displaying on the global address list.

If you run Get-GlobalAddressList "My GAL" if the recipient filter is any bigger than about 3 words it will be cut off, due to the way powershell displays tables.

Easiest way is to pipe the command to Format-List which will display it as list rather than a table.



Monday 1 October 2012

The administrative limit for this request was exceeded.


The administrative limit for this request was exceeded.




As an organization we needed to make some changes to our Global Address List to make it easier for some people to find what they needed.

After creating the global address list and then running Update-GlobalAddressList I ran into the exception:
The administrative limit for this request was exceeded..

The error in this case was caused by the Active Directory attribute userCertificate which was unusually large.  The user was auto-enrolling for a certificate every time they logged in.



To remove the hundreds of certificates I did a very small c# program.


 using System;  
 using System.Collections.Generic;  
 using System.Linq;  
 using System.Text;  
 using System.DirectoryServices;  
 namespace ClearUserCert  
 {  
   class Program  
   {  
     static void Main(string[] args)  
     {  
       DirectoryEntry de = new DirectoryEntry("LDAP://CN=The User,OU=Staff,DC=TheDomain,DC=Local");  
       de.Properties["userCertificate"].Clear();  
       de.CommitChanges();  
       de.Dispose();  
     }  
   }  
 }  

In this case we weren't worried about retaining the users certificates as we didn't need them.

I should also point out you need to either turn off auto-enrolment for users or fix the cause of the multiple certificates.

Update-GlobalAddressList now ran with out a hitch.

Friday 22 June 2012

Sequencing SIMS.net in Microsoft App-v

Sequencing SIMS.net in Microsoft App-v/Soft grid

There are certain components that need to be installed on your image and your sequencing machine.

1. .Net Framework 4.0
2. Windows Installer 4.5

Prepare your Sequencer Machine

1. Map drive to Simsroot share on sims file server.

Sequencing Sims

1. Run SimsInfrastructureSetup.exe
Tick Sims Components
Tick FMS Components
2. Run SimsApplicationsSetup.exe --> Ignore App-V sequencing guidelines and allow Sims to install to default C:\Program Files\SIMS location
3. (Optional) Run SIMSManualSetup.exe
4. Modify Sims Permissions, we have a file called SimsPerm.bat I will post the contents for those who don't have and a secondary file for those running 64bit windows. Ensure you have an up to date version of subinacl.exe as we had an old version which didn't work.
We also found subinacl.exe would report "Invalid Security ID Structure", the cause of this was because the sequencing machine had been reverted from a snapshot and the communication with the domain controller was a bit skewed, just be sure to reboot the virtual machine after reverting from the snapshot.
5. Modify Sims.ini
4. Modify the SIMS shortcut on the start menu to point at pulsar.exe not simsload.exe
6. Run Sims and point at correct connect.ini
7. Tick i've finished installing.
8. Next.
9. Choose OS, we sequenced separately for Windows 7 x64 and Window XP x86.
10. Choose Continue to edit package and save later.
11. Modify Path.
12. Edit LOCAL_INTERACTION_ALLOWED = true.
13. Save

Thursday 19 January 2012

Creating a user on SQL server which maps to a computer account

Sometimes we need to grant a computer rather than a user account access to SQL Server / database.

Unfortunately SQL Server Management Studio doesn't allow you to select a computer account when you create a new login.

Fear not as with most SQL related problems we can fix this via a SQL query which we can run from inside management studio.

EXEC master.dbo.sp_grantlogin @loginame = N'DOMAINNAME\COMPUTERNAME$'

Obviously replace DOMAINNAME with the name of your domain and COMPUTERNAME with the computer name.




Monday 16 January 2012

Running C# / .NET apps on server core

I recently migrated one of our file servers to the server core edition of Server 2008 R2, mainly because we needed to reclaim some of the disk space as the VMDK for the data partition was very heavily over allocated and in thick mode. 


So to regain the space we build a new virtual machine running Server 2008 R2 SP1 Server Core. The data was already part of a DFS tree so we just added the new data location on the new virtual machine as a additional target and waited for the data to complete replication before removing the old server as a target for the DFS folder.


I digress, the original server was running a number of C# / .Net applications that perform house keeping operations on the data and are run via scheduled tasks. 


We copied the applications over and setup the scheduled tasks, but unfortunately we were experiencing the following error:


The application failed to initialize properly (0xc0000135)





We had already installed .NET Framework 4.0 for Server Core but were still receiving the error message, initial thoughts were that the application referenced components that may have used GUI components of Windows which were missing in server core. 


A quick inspection of the source code for the application revealed that this probably wasn't the case, and the point proved by running a blank C# application which still wouldn't run.


Inspection of the download page for .NET Framework 4.0 for Server Core :
http://www.microsoft.com/download/en/details.aspx?id=22833 


reveals that there are several windows components which need to be enabled as well so here are the steps:
  • Turn on WoW64: Start /w ocsetup ServerCore-WOW64
  • Turn on .NET 2.0 layer: Start /w ocsetup NetFx2-ServerCore
  • Turn on .NET 2.0 layer for WoW64: Start /w ocsetup NetFx2-ServerCore-WOW64
  • Install .NET Framework 4.0 for Server Core
We had performed step 2 and step 4, but the application was targeting a 32bit Platform target as Visual Studio 2010 defaults to, so the WoW64 components were also required.