AppVeyor: set powershell execution policy

This commit is contained in:
bergwerkgis 2015-12-16 12:04:35 +00:00
parent 34f7c86caf
commit 1a49fe20fb
2 changed files with 33 additions and 14 deletions

View file

@ -1,19 +1,21 @@
$SystemManaged = Get-WmiObject -Class Win32_ComputerSystem | % {$_.AutomaticManagedPagefile} $PSVersionTable
$PSVersionTable.PSVersion
$SystemManaged = Get-WmiObject -Class Win32_ComputerSystem | % {$_.AutomaticManagedPagefile}
$total_physicalmem = gwmi Win32_ComputerSystem | % {[Math]::round($_.TotalPhysicalMemory/1MB,0)} $total_physicalmem = gwmi Win32_ComputerSystem | % {[Math]::round($_.TotalPhysicalMemory/1MB,0)}
$physical_mem = get-ciminstance -class 'cim_physicalmemory' | % { $_.Capacity/1024/1024} $physical_mem = get-ciminstance -class 'cim_physicalmemory' | % { $_.Capacity/1024/1024}
$PF =gwmi Win32_PageFileUsage $PF =gwmi Win32_PageFileUsage
$PageFileLocation = $PF.Name; $PageFileLocation = $PF.Name;
$PageFileSize = $PF.AllocatedBaseSize $PageFileSize = $PF.AllocatedBaseSize
$CurrentPageFile = Get-WmiObject -Class Win32_PageFileSetting
Write-Host "physical memory : $physical_mem" Write-Host "physical memory : "$physical_mem
Write-Host "total physical memory : $total_physicalmem" Write-Host "total physical memory : "$total_physicalmem
Write-Host "page file system managed : $SystemManaged" Write-Host "page file system managed : "$SystemManaged
Write-Host "page file location : $PageFileLocation" Write-Host "page file location : "$PageFileLocation
Write-Host "page file size : $PageFileSize" Write-Host "page file size : "$PageFileSize
Write-Host page file min size : $CurrentPageFile.InitialSize Write-Host "InitialSize : "${CurrentPageFile}.InitialSize
Write-Host "page file max size : $CurrentPageFile.MaximumSize" Write-Host "MaximumSize : "$CurrentPageFile.MaximumSize
#disable automatically managed page file settings #disable automatically managed page file settings
$c = Get-WmiObject Win32_computersystem -EnableAllPrivileges $c = Get-WmiObject Win32_computersystem -EnableAllPrivileges
@ -23,11 +25,28 @@ if($c.AutomaticManagedPagefile){
$c.Put() | Out-Null $c.Put() | Out-Null
} }
$new_page_size=8192 $new_page_size=18000
$CurrentPageFile = Get-WmiObject -Class Win32_PageFileSetting
if($PageFileSize -lt $new_page_size){ if($CurrentPageFile.InitialSize -ne $new_page_size){
Write-Host "settings new page file size to $new_page_size" Write-Host "settings new page file size to $new_page_size"
$CurrentPageFile.InitialSize=$new_page_size $CurrentPageFile.InitialSize=$new_page_size
$CurrentPageFile.MaximumSize=$new_page_size $CurrentPageFile.MaximumSize=$new_page_size
$CurrentPageFile.Put() | Out-Null $CurrentPageFile.Put() | Out-Null
} }
Write-Host "new ------------ "
Write-Host "system managed:" (Get-WmiObject -Class Win32_ComputerSystem | % {$_.AutomaticManagedPagefile})
Write-Host "page file size:" (gwmi Win32_PageFileUsage).AllocatedBaseSize
Write-Host "InitialSize: "${CurrentPageFile}.InitialSize
Write-Host "MaximumSize: "$CurrentPageFile.MaximumSize
#list drives
Get-WmiObject -Class Win32_LogicalDisk |
Where-Object {$_.DriveType -ne 5} |
Sort-Object -Property Name |
Select-Object Name, VolumeName, FileSystem, Description, VolumeDirty, `
@{"Label"="DiskSize(GB)";"Expression"={"{0:N}" -f ($_.Size/1GB) -as [float]}}, `
@{"Label"="FreeSpace(GB)";"Expression"={"{0:N}" -f ($_.FreeSpace/1GB) -as [float]}}, `
@{"Label"="%Free";"Expression"={"{0:N}" -f ($_.FreeSpace/$_.Size*100) -as [float]}} |
Format-Table -AutoSize

View file

@ -5,10 +5,10 @@ SET EL=0
ECHO =========== %~f0 =========== ECHO =========== %~f0 ===========
ECHO NUMBER_OF_PROCESSORS^: %NUMBER_OF_PROCESSORS% ECHO NUMBER_OF_PROCESSORS^: %NUMBER_OF_PROCESSORS%
ECHO RAM [MB]^: powershell Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Unrestricted -Force
powershell "get-ciminstance -class 'cim_physicalmemory' | %% { $_.Capacity/1024/1024}"
IF %ERRORLEVEL% NEQ 0 GOTO ERROR IF %ERRORLEVEL% NEQ 0 GOTO ERROR
powershell .\scripts\appveyor-system-info.ps1 powershell .\scripts\appveyor-system-info.ps1
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
::only build on AppVeyor, if explicitly stated ::only build on AppVeyor, if explicitly stated
ECHO APPVEYOR_REPO_COMMIT_MESSAGE^: %APPVEYOR_REPO_COMMIT_MESSAGE% ECHO APPVEYOR_REPO_COMMIT_MESSAGE^: %APPVEYOR_REPO_COMMIT_MESSAGE%