Skip to content

Instantly share code, notes, and snippets.

@alastairtree
alastairtree / my_boxstarter
Last active December 5, 2018 10:39
my boxtstarter
choco install firefox -y
choco install 7zip -y
choco install putty -y
choco install notepadplusplus.install -y
choco install nuget.commandline -y
choco install git -y
choco install kdiff3 -y
choco install gitextensions -y
choco install vim -y
choco install fiddler4 -y
Set-WindowsExplorerOptions -EnableShowHiddenFilesFoldersDrives -EnableShowProtectedOSFiles -EnableShowFileExtensions -EnableShowFullPathInTitleBar
Enable-RemoteDesktop
Enable-MicrosoftUpdate
Install-WindowsUpdate -AcceptEula
cinst GoogleChrome
cinst PowerShell4
cinst webpi
cinst notepadplusplus
Set-WindowsExplorerOptions -EnableShowHiddenFilesFoldersDrives -EnableShowProtectedOSFiles -EnableShowFileExtensions -EnableShowFullPathInTitleBar
Enable-RemoteDesktop
Enable-MicrosoftUpdate
Install-WindowsUpdate -AcceptEula
choco install cccp
choco install vlc
choco install powershell4
@alastairtree
alastairtree / CreateSite.ps1
Last active July 7, 2021 12:47
IIS site stop and create website/appPool utility scripts
## 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
@alastairtree
alastairtree / gist:6777218c2c7facc17282
Created July 28, 2014 14:45
grant read execute permissions to a folder via powershell
$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)
Set-WindowsExplorerOptions -EnableShowHiddenFilesFoldersDrives -EnableShowProtectedOSFiles -EnableShowFileExtensions -EnableShowFullPathInTitleBar
Enable-RemoteDesktop
Enable-MicrosoftUpdate
Install-WindowsUpdate -AcceptEula
cinst dotnet4.5.1
cinst firefox
cinst 7zip
cinst putty
@alastairtree
alastairtree / restart.ps1
Created August 6, 2015 14:49
Restart a remote machine using powershell
# 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
@alastairtree
alastairtree / RetryHelper.cs
Last active May 20, 2020 00:47
Retry helper
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
@alastairtree
alastairtree / index.html
Created September 23, 2015 15:11
simple HTML5 holding page
<!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>
Function KillTheService($ServiceName)
{
$service = Get-Service $ServiceName -ErrorAction SilentlyContinue
if (!$service)
{
"Could not find service $ServiceName"
}
else
{