About Msi Installer impersonate problem.
I using vs2010 create installer project to update GPO, the problem is even I run as administrator, there still have permission issue.
The script no problem, when I just run script, it worked fine. but the custom action
when I run the import the GPO backup,
return "Name translation: Could not find the name or insufficient right to see name. "
So I think it is the Installer impersonate problem ,It not run as Administrator or not get full permission.
I search online , find a helpful script, update custom action NoImpersonate, but it run under SYSTEM, it not my need.
Custom Action In-Script Execution Options
http://msdn.microsoft.com/en-us/library/aa368069(v=vs.85).aspx
Mailbag: How to set the NoImpersonate flag for a custom action in Visual Studio 2005
http://blogs.msdn.com/b/astebner/archive/2006/10/23/mailbag-how-to-set-the-noimpersonate-flag-for-a-custom-action-in-visual-studio-2005.aspx
just change a little bit, it worked find.
if with NoImpersonate :
// NoImpersonate.js <msi-file>
// Performs a post-build fixup of an msi to change all deferred custom actions to NoImpersonate
// Constant values from Windows Installer
var msiOpenDatabaseModeTransact = 1;
var msiViewModifyInsert = 1
var msiViewModifyUpdate = 2
var msiViewModifyAssign = 3
var msiViewModifyReplace = 4
var msiViewModifyDelete = 6
var msidbCustomActionTypeInScript = 0x00000400;
var msidbCustomActionTypeNoImpersonate = 0x00000800
var msidbCustomActionTypeTSAware = 0x00004000
if (WScript.Arguments.Length != 1)
{
WScript.StdErr.WriteLine(WScript.ScriptName + " file");
WScript.Quit(1);
}
var filespec = WScript.Arguments(0);
var installer = WScript.CreateObject("WindowsInstaller.Installer");
var database = installer.OpenDatabase(filespec, msiOpenDatabaseModeTransact);
var sql
var view
var record
try
{
sql = "SELECT `Action`, `Type`, `Source`, `Target` FROM `CustomAction`";
view = database.OpenView(sql);
view.Execute();
record = view.Fetch();
while (record)
{
if (record.IntegerData(2) & msidbCustomActionTypeInScript)
{
record.IntegerData(2) = record.IntegerData(2) | msidbCustomActionTypeNoImpersonate;
'change to
record.IntegerData(2) = record.IntegerData(2) & ~msidbCustomActionTypeNoImpersonate;
view.Modify(msiViewModifyReplace, record);
}
record = view.Fetch();
}
view.Close();
database.Commit();
}
catch(e)
{
WScript.StdErr.WriteLine(e);
WScript.Quit(1);
}
No comments:
Post a Comment