public async Task SetExecutionPolicyAsync() { var executionPolicy = "RemoteSigned"; var script = @$ "Set-ExecutionPolicy {executionPolicy} -Force Get-ExecutionPolicy"; var powerShellResult = await powerShell.ExecuteAsync(script); consoleLogger.Result($"PowerShell - Execution Policy: {powerShellResult.AsString}"); windowsPowerShell.Execute(script); consoleLogger.Result($"Windows PowerShell - Execution Policy: {executionPolicy}"); }
public async Task InstallOrUpgradeAsync(IApp app) { consoleLogger.Info($"Installing '{app.AppId}'"); var preInstallDesktopSystemEntries = desktopRepository.LoadSystemEntries(); var preInstallVerificationResult = await VerifyAppAsync(app); var actionScript = GetActionScript(app, preInstallVerificationResult); if (!string.IsNullOrWhiteSpace(actionScript)) { await powerShell.ExecuteAsync(actionScript); await VerifyAppAsync(app); } var postInstallDesktopSystemEntries = desktopRepository.LoadSystemEntries(); var desktopSystemEntriesToDelete = postInstallDesktopSystemEntries.Except(preInstallDesktopSystemEntries).ToList(); if (desktopSystemEntriesToDelete.Any()) { desktopRepository.DeletePaths(desktopSystemEntriesToDelete); } consoleLogger.Result($"Installed '{app.AppId}'"); }
public async Task InstallAsync(IDownloadApp app) { consoleLogger.Info($"Installing '{app.AppId}'"); IDownloader downloader = downloaderFactory.GetDownloader(app.Downloader); var downloadedFilePath = await downloader.DownloadAsync(app.DownloaderArgs.ToString() !); var installScript = $"{app.InstallScript} {downloadedFilePath}"; if (app.VerificationScript == null) { await powerShell.ExecuteAsync(installScript); } else { await powerShell.ExecuteAsync(installScript, app.VerificationScript); } consoleLogger.Result($"Installed '{app.AppId}'"); }