ปกติวิธี Install Windows Service ที่เขียนด้วย VS.Net เป็นดังนี้
InstallUtil.exe MyService.exe
และคำสั่ง Uninstall Windows Service ที่เขียนด้วย VS.Net เป็นดังนี้
InstallUtil.exe /u MyService.exe
อย่างเช่นมีไฟล์ Windows Service ชื่อ KillLoginSession โดยจะมีทั้ง file exe และ file config
ไว้ใน folder C:\service1 ดังรูป

เมื่อ run คำสั่งดังนี้
%WINDIR%\Microsoft.NET\Framework\v2.0.50727\InstallUtil.exe c:\service1\KillLoginSession.exe
แล้วเปิด Services ของ Windows ขึ้นมา จะมี Service KillLoginSession ปรากฎดังรูป

ซึ่ง Service ตัวนี้จะมี Properties ดังนี้

คือมี Service name = KillLoginSessionService
และมี Display name = ALIST Kill Login Session Service
ถ้าต้องการติดตั้ง Service KillLoginSession เพิ่ม เพราะบางครั้งต้องการใช้ Service เดิมแต่ปรับแก้ค่าที่ config file
ก็ทำการ copy Service KillLoginSession ไปไว้เพิ่มใน folder C:\service2 ดังรูป

แล้ว run คำสั่ง
%WINDIR%\Microsoft.NET\Framework\v2.0.50727\InstallUtil.exe c:\service2\KillLoginSession.exe
จะปรากฎ error ดังรูป

คือมี service นี้ติดตั้งอยู่แล้ว
วิธีแก้คือ ให้ใส่ code ดังนี้
sc create <servicename> binpath= “<pathtobinaryexecutable>” [option1] [option2] [optionN]
<servicename> คือ ชื่อ service ที่กำหนดขึ้นมาโดยต้องไม่ตรงกับ service ที่ทำงานอยู่
<pathtobinaryexecutable> คือ ตำแหน่งที่ตั้งของ file service ที่จะทำการ Install
[option] ไว้สำหรับใส่คำสั่งอย่างอื่นเพิ่ม เช่น Display Name จะมีหรือไม่มีก็ได้
ใส่ code ตามข้างบนได้ดังนี้
sc create KillLoginSessionTest binpath=”C:\service2\KillLoginSession.exe” DisplayName=”ALIST Kill Login Session Test”
จะได้ผลดังรูป

มี Properties ดังนี้

คือมี Service name กับ Display name ตามที่ได้กำหนดไว้
คำสั่งสำหรับ Uninstall ก็คือ
sc delete <servicename>
ถ้าต้องการ Uninstall Service ที่สร้างขึ้นก็ใส่ code ดังนี้
sc delete KillLoginSessionTest