Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 736935
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T07:39:43+00:00 2026-05-14T07:39:43+00:00

I’m installing a desktop shortcut (to a batch file) from a WiX-based installer —

  • 0

I’m installing a desktop shortcut (to a batch file) from a WiX-based installer — how do I automatically configure this shortcut with the “Run as Administrator” setting enabled? The target OS is Windows Server 2008 R2, and the installer is running with elevated priveleges.

Update:
Thanks to the link provided by @Anders, I was able to get this working. I needed to do this in a C# CustomAction, so here is the C# version of the code:

namespace CustomAction1
{
 public class CustomAction1
 {
  public bool MakeShortcutElevated(string file_)
  {
   if (!System.IO.File.Exists(file_)) { return false; }

   IPersistFile pf = new ShellLink() as IPersistFile;
   if (pf == null) { return false; }

   pf.Load(file_, 2 /* STGM_READWRITE */);
   IShellLinkDataList sldl = pf as IShellLinkDataList;
   if (sldl == null) { return false; }

   uint dwFlags;
   sldl.GetFlags(out dwFlags);
   sldl.SetFlags(dwFlags | 0x00002000 /* SLDF_RUNAS_USER */);
   pf.Save(null, true);
   return true;
  }
 }

 [ComImport(), Guid("00021401-0000-0000-C000-000000000046")]
 public class ShellLink { }

 [ComImport(), InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("45e2b4ae-b1c3-11d0-b92f-00a0c90312e1")]
 interface IShellLinkDataList
 {
  void AddDataBlock(IntPtr pDataBlock);
  void CopyDataBlock(uint dwSig, out IntPtr ppDataBlock);
  void RemoveDataBlock(uint dwSig);
  void GetFlags(out uint pdwFlags);
  void SetFlags(uint dwFlags);
 }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T07:39:43+00:00Added an answer on May 14, 2026 at 7:39 am

    I’m guessing you would need a custom action and call the COM interfaces on your own. Query IShellLink (or IPersistFile?) for IShellLinkDataList, then: IShellLinkDataList->SetFlags(orgFlagsFromGetFlags|SLDF_RUNAS_USER);

    Edit: Raymond has full sample code on his blog

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
Does anyone know how can I replace this 2 symbol below from the string
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I want use html5's new tag to play a wav file (currently only supported
In my XML file chapters tag has more chapter tag.i need to display chapters

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.