This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Data; | |
using System.Reflection; | |
using OfficeOpenXml; | |
using OfficeOpenXml.Table; | |
namespace Utils | |
{ | |
public static class ExcelExportTool |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## -------------------------------------------------------------------------------------- | |
## Configuration | |
## -------------------------------------------------------------------------------------- | |
$isEnabled = $OctopusParameters["Octopus.Action.WindowsService.CreateOrUpdateService"] | |
if (!$isEnabled -or ![Bool]::Parse($isEnabled)) | |
{ | |
exit 0 | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function KillTheService($ServiceName) | |
{ | |
$service = Get-Service $ServiceName -ErrorAction SilentlyContinue | |
if (!$service) | |
{ | |
"Could not find service $ServiceName" | |
} | |
else | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<meta content="IE=edge" http-equiv="X-UA-Compatible"> | |
<meta content="width=device-width, initial-scale=1.0" name="viewport"> | |
<title>[TITLE]</title> | |
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"> | |
<style> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class RetryHelper | |
{ | |
private static ILog logger = LogManager.GetLogger(); //use a logger or trace of your choice | |
public static void RetryOnException(int times, TimeSpan delay, Action operation) | |
{ | |
var attempts = 0; | |
do | |
{ | |
try |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# at an PS> prompt with sufficient admin credentials | |
Restart-Computer ServerName -force | |
# or | |
# Restart-Computer "ServerName1", "ServerName2" -force | |
# More info https://mcpmag.com/articles/2012/04/10/how-to-restart-computers-remotely-via-powershell.aspx |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Set-WindowsExplorerOptions -EnableShowHiddenFilesFoldersDrives -EnableShowProtectedOSFiles -EnableShowFileExtensions -EnableShowFullPathInTitleBar | |
Enable-RemoteDesktop | |
Enable-MicrosoftUpdate | |
Install-WindowsUpdate -AcceptEula | |
cinst dotnet4.5.1 | |
cinst firefox | |
cinst 7zip | |
cinst putty |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$path = "C:\Sites\Website123" | |
$user = "domain\user" | |
$acl = Get-Acl $path | |
$arguments = $user, "ReadAndExecute", "ContainerInherit, ObjectInherit", "None", "Allow" | |
$accessRule = New-Object System.Security.AccessControl.FileSystemAccessRule $arguments | |
$acl.SetAccessRule($accessRule) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## FYI: These scripts are now maintained in a proper repository: | |
## https://github.com/alastairtree/deploy-websites-with-powershell | |
## Intro: Simple powershell script to install (or replace) a local website and app pool | |
## Usage: CreateSite.ps1 [WebsiteName] [AppPoolName] [Port] [Path] ([domain\user] [password]) | |
## Note : These scripts require local admin priviliges! | |
# Load IIS tools | |
Import-Module WebAdministration | |
sleep 2 #see http://stackoverflow.com/questions/14862854/powershell-command-get-childitem-iis-sites-causes-an-error |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Set-WindowsExplorerOptions -EnableShowHiddenFilesFoldersDrives -EnableShowProtectedOSFiles -EnableShowFileExtensions -EnableShowFullPathInTitleBar | |
Enable-RemoteDesktop | |
Enable-MicrosoftUpdate | |
Install-WindowsUpdate -AcceptEula | |
choco install cccp | |
choco install vlc | |
choco install powershell4 |