All 6 entries tagged Windows

View all 19 entries tagged Windows on Warwick Blogs | View entries tagged Windows at Technorati | There are no images tagged Windows on this blog

February 07, 2007

Installing ClickOnce application as non–admin user

Insight shipped a while ago. It is deployed as a ClickOnce application. The bootstrap setup.exe created by the .NET SDK is excellent in that it detects missing pre-requisites on a user’s machine, downloads and installs them.
The problem is that a non-admin user will not be able to install components such as the .NET Framework, Microsoft Reporting Library, etc.
“Right-click, RunAs admin” on the setup.exe works except that the Start Menu entry for the application is put in the Administrator’s start menu and home directory. This means the user has to run Setup.exe again as themself! Argh, imagine the support calls on that one…

My solution is to make a ZIP file containing setup.exe, Install.bat and part2.bat.
Install.bat contains:

@echo off
set _User_=%USERDOMAIN%%USERNAME%
set _wd_=%CD%

echo Installing Insight for %_User_%.
runas /u:%COMPUTERNAME%\Administrator "cmd.exe /c CD \"%_wd_%\" && part2.bat \"%_User_%\" \"%_wd_%\""

which upon running prompts:

Installing Insight for WORK\Andrew Davey.
Enter the password for WORK\Administrator: 

The user types the admin password, hits enter. That runs part2.bat:

@echo off
echo Giving %1 temporary Administrator status
net localgroup Administrators %1 /ADD
echo Running Insight install program
runas /u:%1 "cmd.exe /c CD %CD% && setup.exe" 
echo Removing %1's Administrator status
net localgroup Administrators %1 /DELETE

That adds the user to the Administrator group, then runs setup.exe as the user (but now with admin permissions). Afterwards, the user is removed from the Administrator group.

I took the idea from the MakeMeAdmin.cmd batch file. I could not seem to pass the current directory using MakeMeAdmin, so it could not find setup.exe. That’s why I have two batch files.
Maybe someone can point out how it should be done.

So the result is I can tell someone to download the ZIP, extract and double-click Install.bat. Whilst that’s not exactly “ClickOnce” anymore, it slightly better than the alternative! Of course once installed, any later application updates go into the user’s directory so no admin permissions are required.
I hope Microsoft update the bootstrapper in the next version so that it can handle non-admin users better.


May 27, 2006

Download WMP Podcast Plugin

Follow-up to Updated Podcasts in Media Player Plugin from codeMonkey.Weblog();

You can now download the plug–in. It's still in beta and comes with no guarantees, so use at your own risk. If you find any bugs, etc please let me know.

Enjoy!

EDIT
You must be using IE 7 (Beta 2) for this to work. The plug–in uses the new feed subscription feature of IE 7 to pull in podcasts. Subscribe to feeds within IE 7 and make sure you check the "Download attached files" box – this will make it download podcasts.


May 11, 2006

Updated Podcasts in Media Player Plugin

New screen shot of my PiMP (Podcasts in Media Player) plug–in. (Click for full screen view)
wmp plugin 2

I ditched the slow and ugly grid for a nicer custom item list view control. Un–played shows are indicated by an icon. Click play starts a show playing. Clicking "Show Notes" opens a window to read HTML show notes.

I want to add sync stuff next and also scan show notes for time codes (hh:mm) and then skip playback to those locations.


May 10, 2006

WMP Plug–in base library

During my adventures creating Windows Media Player plug–ins in .NET I decided it would be good to have a standard base library to handle most of the WMP goo–code. The result is that making a simple plug–in now consists of just:
using System;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using Equin.WmpPluginLibrary;

namespace Test
{
[FriendlyName("My Plug-in")]
[Description("Example plug-in using Equin library.")]
[PluginType(PluginType.DisplayArea)]
[ComVisible(true)]
[Guid("8E8A3CA8-2464-423e-BED7-AF914B1449A4")]
public class MyPlugin : PluginBase
{
public override System.Windows.Forms.Control CreateUI()
{
Label label = new Label();
label.Text = "Hello, world!";
return label;
}
}

[System.ComponentModel.RunInstaller(true)]
public class Installer : PluginInstaller<MyPlugin>
{

}
}

The class uses some custom attributes to describe the plug–in. These are used by the PluginInstaller to set WMPs registry settings.

If anyone is interested in developing WMP plug–ins using .NET then leave a comment. I'll probably make the library source available online if there is sufficient interest…


May 09, 2006

WMP Podcast Plug–In

IE7's feed subscription engine will download enclosures if you tell it too (it's a per–feed setting). However the IE feed browser does not have a direct way to see which items have enclosures. So I decided to create a plug–in for Windows Media Player. The plug–in reads the user's "common feed list" looking for downloaded audio enclosures. These are then listed in a simple grid directly within WMP. I can then simply click a file to start playing.
Screenshot:
WMP Plug-In

I wrote the plug–in in just a few hours using VS.NET 2005 with C#2.0! There are still enhancements required, but it does work great already.

Having the MS feed engine syncing all my feeds (podcasts, news, blogs, everything!) and using different applications to view aspects of them is better than trying to have one application do everything.

I may add support for searching and browsing podcast specific content (podcast alley, etc). No need to install iTunes at all! :D


September 20, 2005

Standard User

I re-installed XP today and decided to try out running as a standard user, not as an administrator. (I did only switch once I got Office and Visual Studio installed.)

When I do need to be admin, I use this tool: link This prompts for the Administrator password, then mine, which adds me to the Administrators group for the context of a command prompt. Anything I run from that prompt runs with my increased privileges.

I'm going to give it a week or so and see how I get on.


Google Ads

Search this blog

Most recent comments

  • I scratched my eye while i was holding some kind of plastic packaging.. Anyways the corner of the pl… by Ercan on this entry
  • About a year ago my contacts that i was wearing, i guess were fautly, because shortly after they wer… by Jon on this entry
  • I got shower gel in my eye 4 and a half days ago, and becasue i rubbed my eyes a lot, i have scratch… by Chris on this entry
  • This website may help http://www.webmd.com/eye–health/tc/Eye–Injuries–Home–Treatment by S on this entry
  • I somehow got dirt, or debris in my eye. The terrible pain sent me in a tailspin. I was afraid of sa… by Bobbi on this entry

Tags

May 2018

Mo Tu We Th Fr Sa Su
Apr |  Today  |
   1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31         

Galleries

Blog archive

Loading…
RSS2.0 Atom
Not signed in
Sign in

Powered by BlogBuilder
© MMXVIII