Skip to content

Instantly share code, notes, and snippets.

View goyalmohit's full-sized avatar

mohit goyal goyalmohit

  • Pune, India
View GitHub Profile
@goyalmohit
goyalmohit / New-RandomPassword.ps1
Last active April 16, 2017 09:18
Generate random password using PowerShell
#function starts here
function New-RandomPassword()
{
#specifies the default maximum no of characters to be generated for password
#can be override by passing parameter values while calling function
param(
[int]$maxChars=8
)
#update list of repositories
sudo yum update
sudo reboot
#install jdk
sudo yum install java-1.8.0-openjdk.x86_64
#set export variables for java
export JAVA_HOME='/usr/lib/jvm/jre-1.8.0-openjdk'
export JRE_HOME='/usr/lib/jvm/java-8-openjdk-amd64/jre'
# Configures execution policy to remotesigned
if($(Get-ExecutionPolicy) -ne "RemoteSigned"){
Set-ExecutionPolicy RemoteSigned -Confirm:$false
}
# Installs chocolatey package manager
iwr https://chocolatey.org/install.ps1 -UseBasicParsing | iex
# Installs JDK8 using chocolatey
choco install jdk8 -y
#update list of repositories
sudo apt-get update
#install jre and jdk
sudo apt-get install openjdk-8-jre
sudo apt-get install openjdk-8-jdk
#set export variables for java
export JAVA_HOME='/usr/lib/jvm/jre-1.8.0-openjdk'
export JRE_HOME='/usr/lib/jvm/java-8-openjdk-amd64/jre'
#Login into Microsoft Azure
add-azureaccount
#Create a new storage account, if not already having one
$storageAccountName = "qastoragenortheurope"
$storageAccountLocation = "north europe"
$storageAccountType = "Standard_LRS"
New-AzureStorageAccount -StorageAccountName $storageAccountName `
-Location $storageAccountLocation `
-Type $storageAccountType
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"firstArray": {
"type": "array",
"defaultValue": [
"1-1",
"1-2",
"1-3"
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.1.0",
"parameters": {
"firstArray": {
"type": "array",
"defaultValue": "1-1 1-2 1-3"
},
"secondArray": {
"type": "array",
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.1.0",
"parameters": {
"firstArray": {
"type": "array",
"defaultValue": [
"1-1",
"1-2",
"1-3"
@goyalmohit
goyalmohit / install-octopus-using-powershell-dsc
Created November 25, 2017 21:47
Install and Configure Octopus Server using PowerShell DSC
Configuration SampleConfig
{
Import-DscResource -Module OctopusDSC
Node "localhost"
{
cOctopusServer OctopusServer
{
Ensure = "Present"
State = "Started"
@goyalmohit
goyalmohit / defining-msbuild-properties-project-file-samples-01
Last active December 3, 2017 13:56
Defining MSBuild Properties - Project File Samples 01
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<BuildDir>C:\Source\Repo\MyRepo\Bin</BuildDir>
</PropertyGroup>
</Project>