Wednesday, July 16, 2008

Running SSIS Package gives: error failed validation and returned validation status "VS_NEEDSNEWMETADATA"

When running a SSIS package with a data pump task, if you receive an error similar to failed validation and returned validation status "VS_NEEDSNEWMETADATA" the problem could be that the security for the account running the package is not setup for the object being called within the data pump task source task. In the case this was found, the data pump was calling a stored proc in another database and that stored proc joined to data in another databases. The AD account for the system that was running the package needed to have rights to execute the store proc in the first database as well as the rights on the view the stored proc was joining to. The best way to troubleshoot this problem is to create a new package and have it execute a SQL task that calls the stored proc. Then run the package on the server and this will help pin point where the problem occurs.

Thursday, July 3, 2008

Get list of AD group members

Quick and dirty way to do this.


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.DirectoryServices;
namespace ADTest
{
public partial class Form2 : Form
{
public const string adpath = "LDAP://domain.com/";
public Form2()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Boolean iresult;
iresult = GetGroupMembers(textBox2.Text);
}
public static DirectoryEntry GetDirectoryEntry()
{
DirectoryEntry de = new DirectoryEntry();
de.Path = adpath;
de.AuthenticationType = AuthenticationTypes.Secure;
return de;
}
public bool GetGroupMembers(string GroupName)
{
DirectoryEntry de = GetDirectoryEntry();
DirectorySearcher ds = new DirectorySearcher(de);
ds.Filter = "(&(objectClass=group)(cn=" + GroupName + "))";
SearchResult results = ds.FindOne();
if (results != null)
{
DirectoryEntry deGroup = new DirectoryEntry(results.Path);
System.DirectoryServices.PropertyCollection pcoll = deGroup.Properties;
int n = pcoll["member"].Count;
textBox1.Text = n.ToString();
for (int l = 0; l < n; l++)
{
DirectoryEntry deUser = new DirectoryEntry(adpath + "/" + pcoll["member"][l].ToString());
richTextBox1.Text = richTextBox1.Text + GetProperty(deUser,"givenName") + " " + GetProperty(deUser,"sn") + "\n";
deUser.Close();
}
deGroup.Close();
de.Close();
return true;
}
else
{
de.Close();
return false;
}
}
public static string GetProperty(DirectoryEntry oDE, string PropertyName)
{
if (oDE.Properties.Contains(PropertyName))
{
return oDE.Properties[PropertyName][0].ToString();
}
else
{
return string.Empty;
}
}
}
}