Skip to content

Instantly share code, notes, and snippets.

View adoprog's full-sized avatar

Alexander Doroshenko adoprog

View GitHub Profile
Set-ExecutionPolicy RemoteSigned
$mongoDbPath = "C:\MongoDB"
$mongoDbConfigPath = "$mongoDbPath\mongod.cfg"
$url = "http://downloads.mongodb.org/win32/mongodb-win32-x86_64-2008plus-2.4.9.zip"
$zipFile = "$mongoDbPath\mongo.zip"
$unzippedFolderContent ="$mongoDbPath\mongodb-win32-x86_64-2008plus-2.4.9"
if ((Test-Path -path $mongoDbPath) -eq $True)
{
Update-ExecutionPolicy Unrestricted
Enable-WindowsOptionalFeature -Online -FeatureName IIS-WebServerRole
Enable-WindowsOptionalFeature -Online -FeatureName NetFx3
Enable-WindowsOptionalFeature -Online -FeatureName NetFx4Extended-ASPNET45
Enable-WindowsOptionalFeature -Online -FeatureName IIS-HttpRedirect
Enable-WindowsOptionalFeature -Online -FeatureName IIS-NetFxExtensibility
Enable-WindowsOptionalFeature -Online -FeatureName IIS-NetFxExtensibility45
Enable-WindowsOptionalFeature -Online -FeatureName IIS-WindowsAuthentication
Enable-WindowsOptionalFeature -Online -FeatureName IIS-ManagementScriptingTools
@adoprog
adoprog / Program.cs
Last active August 29, 2015 14:28
Sample code - Opserver API
var allNodes = DashboardData.AllNodes.Where(s => !s.IsUnwatched).Where(s => s.CPULoad >= 0 || s.MemoryUsed >= 0).ToList();
var downNodes = allNodes.Where(x => x.Status == NodeStatus.Down);
Thread.Sleep(3000);
float inBps = 0;
float outBps = 0;
var totalRam = 0.0;
var totalDisk = 0.0;
foreach (var node in allNodes)
@adoprog
adoprog / DashboardSettings.json
Created August 25, 2015 13:49
DashboardSettings.json sample configuration
"providers": [
{
"name": "Orion",
"type": "Orion",
"host": "monitorXd1:8686",
"connectionString": "Data Source=monitorXd1;Initial Catalog=SolarWindsOrion;User ID='SolarWindsOrionDatabaseUser';Password='put the password here';Timeout=10"
}
]
@adoprog
adoprog / app.config.xml
Last active August 29, 2015 14:28
Opserver app.config example
<configSections>
<section name="Settings" type="StackExchange.Opserver.SettingsSection, StackExchange.Opserver.Core" />
<section name="SecuritySettings" type="StackExchange.Opserver.SecuritySettings, StackExchange.Opserver.Core" />
<section name="Exceptional" type="StackExchange.Exceptional.Settings, StackExchange.Opserver.Core" />
</configSections>
<SecuritySettings configSource="Config\SecuritySettings.config" />
<Settings name="JSON" provider="JSONFile" path="~\Config\" />
<Exceptional applicationName="Status">
@adoprog
adoprog / gist:5361702
Created April 11, 2013 08:26
Run Watin tests from PowerShell
$checkoutFolder = "%teamcity.build.workingDir%"
$targetDll = "$checkoutFolder\bin\Debug\%DLL containing tests here%"
$fixture = "%your namespace here%"
$resultXml = "$checkoutFolder\TestResult.xml"
$resultHtml = "$checkoutFolder\TestResults"
rm $resultXml -Force -Verbose
rm $resultHtml -Force -Verbose -Recurse
$buildOptions = "/xml:$resultXml /fixture:$fixture"
properties {
$buildFolder = Resolve-Path ..
$revision = "100500"
$buildNumber = "15"
}
task Package -depends Init, Upt, Zip
task Init {
# Copy Sitecore DLL's, etc.
@adoprog
adoprog / gist:5363165
Created April 11, 2013 12:58
Run psake script
Remove-Module [p]sake
Import-Module .\Tools\psake\psake.psm1
$psake.use_exit_on_error = $true
Invoke-psake .\package.ps1 Package -properties @{ revision = '%env.BUILD_VCS_NUMBER%'; }
@adoprog
adoprog / gist:5418727
Created April 19, 2013 07:34
Copy Sitecore files to solution.
properties {
$distributivePath = "%path to storage%\Sitecore 6.6.0 rev. 130111.zip"
$localStorage = "C:\LocalStorage"
$distributiveName = [System.IO.Path]::GetFileNameWithoutExtension($distributivePath)
$zipFile = "$localStorage\$distributiveName.zip"
$buildFolder = Resolve-Path ..
$revision = "12345"
$buildNumber = "1"
}
@adoprog
adoprog / gist:5442033
Created April 23, 2013 09:10
PowerCore Deployment
Clear-Host
# Framework initialization
$scriptRoot = Split-Path (Resolve-Path $myInvocation.MyCommand.Path)
$env:PSModulePath = $env:PSModulePath + ";$scriptRoot\Framework"
Import-Module WebUtils
Import-Module ConfigUtils
Import-Module DBUtils
Import-Module IISUtils