Skip to content

Instantly share code, notes, and snippets.

View goyalmohit's full-sized avatar

mohit goyal goyalmohit

  • Pune, India
View GitHub Profile
#Specify the directory location to export files
$dirName = "c:\spbackups"
if(!(Test-Path $dirName)){
New-Item -Path $dirName -ItemType Directory -Force
}
Write-Output Exporting solutions to $dirName
foreach ($solution in Get-SPSolution)
[System.Reflection.Assembly]::Load("System.EnterpriseServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
$publish = New-Object System.EnterpriseServices.Internal.Publish
$publish.GacInstall("F:\Dlls for FBA\Metavrse.SharePoint.SyncLib.dll")
#Login into Microsoft Azure
add-azureaccount
#Set default storage account for current azure subscription
Set-AzureSubscription -SubscriptionId <your subscription id> -CurrentStorageAccountName "qastoragenortheurope"
#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
$imageName = Get-AzureVMImage |
where { $_.ImageFamily -eq $imageFamily } |
sort PublishedDate -Descending |
select -ExpandProperty ImageName -First 1
#create quick azure vm
$adminUser = "itadmin"
$password = "itadmin@123"
$serviceName = "metavrsewebqa"
$location = "north europe"
$size = "Small"
$vmName = "metavrse-web-01"
$imageFamily = "Windows Server 2012 R2 Datacenter"
New-AzureQuickVM -Windows `
#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
@goyalmohit
goyalmohit / read-multi-line-input-from-powershell.ps1
Last active April 16, 2017 09:15
Read multi line input from users in PowerShell using messagebox
# This script is used in a blog post on the https://mohitgoyal.co/2017/04/16/read-multi-line-input-from-users-in-powershell/. Please
# read the blog post for more information
function Read-MultiLineInputBoxDialog([string]$Message, [string]$WindowTitle, [string]$DefaultText)
{
Add-Type -AssemblyName System.Drawing
Add-Type -AssemblyName System.Windows.Forms
# Create the Label.
$label = New-Object System.Windows.Forms.Label
@goyalmohit
goyalmohit / open-firewall-port-80-centos.sh
Last active April 16, 2017 09:17
Open firewall for port 80 on CentOS
#this command configure firewall to accept incoming tcp connections on port 80
firewall-cmd --zone=public --permanent --add-port=80/tcp
firewall-cmd --reload