Last active
September 24, 2015 10:41
-
-
Save grenade/41e90b4ab67d1eb6a39c to your computer and use it in GitHub Desktop.
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
| $m = New-Object Amazon.EC2.Model.BlockDeviceMapping | |
| $m.DeviceName = 'xvdcb' | |
| $m.NoDevice = $true | |
| C:\tmp\disks.ps1 |
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 Set-PagefileSize { | |
| <# | |
| .Synopsis | |
| #> | |
| param ( | |
| [int] $initialSize = 1024, | |
| [int] $maximumSize = 1024 | |
| ) | |
| $pf = Get-WmiObject -Query "Select * From Win32_PageFileSetting Where Name='c:\\pagefile.sys'" | |
| if (($initialSize -ne $pf.InitialSize) -or ($maximumSize -ne $pf.MaximumSize)) { | |
| Write-Log -message ('setting pagefile size: initial: {0} -> {1}, maximum: {2} -> {3}' -f $pf.InitialSize, $initialSize, $pf.MaximumSize, $maximumSize) -severity 'INFO' | |
| $sys = Get-WmiObject Win32_ComputerSystem -EnableAllPrivileges | |
| $sys.AutomaticManagedPagefile = $False | |
| $sys.Put() | |
| $pf.InitialSize = $initialSize | |
| $pf.MaximumSize = $maximumSize | |
| $pf.Put() | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment