Skip to content

Instantly share code, notes, and snippets.

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
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
Function KillTheService($ServiceName)
{
$service = Get-Service $ServiceName -ErrorAction SilentlyContinue
if (!$service)
{
"Could not find service $ServiceName"
}
else
{
## --------------------------------------------------------------------------------------
## Configuration
## --------------------------------------------------------------------------------------
$isEnabled = $OctopusParameters["Octopus.Action.WindowsService.CreateOrUpdateService"]
if (!$isEnabled -or ![Bool]::Parse($isEnabled))
{
exit 0
}
@alastairtree
alastairtree / create-and-share.bat
Created December 14, 2015 12:04
cmd.exe/psexec.exe oneliner to create a folder and share it
REM Will create c:\Deploy, share as "\\server\Deploy"
REM and grant change permissions to administrators and users
cmd /c "(C: & (mkdir C:\Deploy 2> NUL)) & (net share Deploy=C:\Deploy /grant:"Users",CHANGE /grant:Administrators,CHANGE 2> NUL)"
@alastairtree
alastairtree / ExcelExportTool.cs
Created December 7, 2015 11:34
Export items to an excel spreadsheet
using System;
using System.Collections.Generic;
using System.Data;
using System.Reflection;
using OfficeOpenXml;
using OfficeOpenXml.Table;
namespace Utils
{
public static class ExcelExportTool
@alastairtree
alastairtree / System Design.md
Created April 18, 2016 03:27 — forked from vasanthk/System Design.md
System Design Cheatsheet

#System Design Interview Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

##Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
$DemoUser = 'Domain\username'
$DemoPass = 'complexpassword'
$Command = "ECHO 'Hello world'; WhoAmi;"
$StdOutLogFile = "$env:windir\temp\PowerShellElevatedStdOut.log"
$SecurePassword = ConvertTo-SecureString $DemoPass -AsPlainText -Force
$Credential = New-Object System.Management.Automation.PSCredential $DemoUser, $securePassword
"Running '$Command' as current user"