Skip to content

Instantly share code, notes, and snippets.

Avatar

Alastair Crabtree alastairtree

View GitHub Profile
View my_boxstarter
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
View SetupServer
Set-WindowsExplorerOptions -EnableShowHiddenFilesFoldersDrives -EnableShowProtectedOSFiles -EnableShowFileExtensions -EnableShowFullPathInTitleBar
Enable-RemoteDesktop
Enable-MicrosoftUpdate
Install-WindowsUpdate -AcceptEula
cinst GoogleChrome
cinst PowerShell4
cinst webpi
cinst notepadplusplus
View gist:fa2c08c5d6e79bc6e1ed
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 Nov 12, 2020
IIS site stop and create website/appPool utility scripts
View CreateSite.ps1
## 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 Jul 28, 2014
grant read execute permissions to a folder via powershell
View gist:6777218c2c7facc17282
$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)
View SetupControllerPC
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 Aug 6, 2015
Restart a remote machine using powershell
View restart.ps1
# 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
View RetryHelper.cs
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 Sep 23, 2015
simple HTML5 holding page
View index.html
<!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>
View DeleteWindowsService.ps1
Function KillTheService($ServiceName)
{
$service = Get-Service $ServiceName -ErrorAction SilentlyContinue
if (!$service)
{
"Could not find service $ServiceName"
}
else
{