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 6909377
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T08:40:54+00:00 2026-05-27T08:40:54+00:00

I am trying to install a windows service from Power-shell as follows. $sn =

  • 0

I am trying to install a windows service from Power-shell as follows.

$sn = """" + $serviceName + " " + $exeName + """"
C:\Windows\Microsoft.NET\Framework\v2.0.50727\InstallUtil.exe -i /ServiceName=[$sn]  $exeFilePath

I am getting the following exception.

Microsoft (R) .NET Framework Installation utility Version 2.0.50727.3053
Copyright (c) Microsoft Corporation.  All rights reserved.

Exception occurred while initializing the installation:
System.IO.FileNotFoundException: Could not load file or assembly 'file:///E:\Scheduled' or one of its dependencies. The system cannot f
ind the file specified..

But the following command work.

C:\Windows\Microsoft.NET\Framework\v2.0.50727\InstallUtil.exe -i /ServiceName=["Scheduled Download Service"]  $exeFilePath

I am trying to install the Windows Service with a dynamic name and using Power-shell I pass the Service Name. Any help is appreciated.

The answer is correct for VS 2008. But will fail in VS 2012. Because InstallUtil is modified.

You should use
$sn = """" + $serviceName + " " + $exeName + """"

The reason is, InstallUtil(2.0) automatically adds the quotes and so we should ignore them (as in the answer). But InstallUtil(4), this is skipped if the string contains quotes in any location (which is a bug? – they should have checked whether there are quotes in the beginning and ending of the string – Currently this breaks all 2.0 code).

Reflecter is your friend.

  • 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-27T08:40:55+00:00Added an answer on May 27, 2026 at 8:40 am

    Your problem is in this line:

    $sn = """" + $serviceName + " " + $exeName + """"
    

    If you will replace it with something simpler, or do it like this:

    $sn = $serviceName.ToString() + " " + $exeName
    

    It will work

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

Sidebar

Related Questions

I'm trying to install windows service using the Microsoft.Sdc.Tasks library. <ControlService Action=Install ServiceName=Service1 User=XXX
I am trying to install a Windows service using InstallUtil.exe and am getting the
I am on win 7 and trying to install a .NET windows service using
.NET 4.0, Windows 7, VS 2010: Trying to install 64-bit service using the Setup
Trying to Install a service onto a server, currently running under .Net Framework 2.0
I am trying to install a windows service using MSBuild and CCNET. I am
I am trying to install a windows service written in c#/ VS2010, which uses
When trying to install my 32bit service on a Windows 64bit machine my installer
I am trying to install a simple java application as a windows service using
I'm trying to install Jenkins-1.464 at the first time as the windows service on

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.