diff --git a/AutoUpdater.NET/AutoUpdater.cs b/AutoUpdater.NET/AutoUpdater.cs
index b7d9e44f..5d7b26d8 100644
--- a/AutoUpdater.NET/AutoUpdater.cs
+++ b/AutoUpdater.NET/AutoUpdater.cs
@@ -119,6 +119,16 @@ public static class AutoUpdater
/// If this is true users can see the skip button.
///
public static Boolean ShowSkipButton = true;
+
+ ///
+ /// Set this to true if you want to run updater on another account other than current user or admin. Very usefull in the case of service account
+ ///
+ public static bool RunUpdateAsUser = false;
+
+ ///
+ /// Set credentials for service account which will be used to invoke updater
+ ///
+ public static NetworkCredential ServiceAccount;
///
/// If this is true users can see the Remind Later button.
@@ -821,4 +831,4 @@ public override string ToString()
return $"Basic {token}";
}
}
-}
\ No newline at end of file
+}
diff --git a/AutoUpdater.NET/DownloadUpdateDialog.cs b/AutoUpdater.NET/DownloadUpdateDialog.cs
index cb5f3976..1b16324c 100644
--- a/AutoUpdater.NET/DownloadUpdateDialog.cs
+++ b/AutoUpdater.NET/DownloadUpdateDialog.cs
@@ -222,6 +222,18 @@ private void WebClientOnDownloadFileCompleted(object sender, AsyncCompletedEvent
{
processStartInfo.Verb = "runas";
}
+
+ if(AutoUpdater.RunUpdateAsUser && AutoUpdater.ServiceAccount != null)
+ {
+ SecureString ssPwd = new SecureString();
+
+ Array.ForEach(AutoUpdater.ServiceAccount.Password.ToCharArray(), ssPwd.AppendChar);
+ ssPwd.MakeReadOnly();
+
+ processStartInfo.Domain = AutoUpdater.ServiceAccount.Domain;
+ processStartInfo.UserName = AutoUpdater.ServiceAccount.UserName;
+ processStartInfo.Password = ssPwd;
+ }
try
{
@@ -334,4 +346,4 @@ protected override WebResponse GetWebResponse(WebRequest request, IAsyncResult r
return webResponse;
}
}
-}
\ No newline at end of file
+}