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
$vms=import-csv (Read-Host "Enter csv file path with vmname,vmrg and subscription columns") | |
$i=0 | |
$vml=$vms.length | |
$i=0 | |
$vms | foreach-object -Parallel { | |
$i++ | |
Write-Host "Working on #" $i | |
Write-Host "Total items #" $vml | |
set-azcontext -subscription $vm.subscription |
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
az group create --location eastus --name rg_Name # creates new resource group | |
az vm create --resource-group rg_Name --name VMName --generate-ssh-keys --admin-username admuser --image ubuntuLTS --public-ip-sku Standard #Create ubuntu vm . 1cpu, 3.5GB RAM allows ssh to all ip's | |
az vm delete --resource-group rgname --name vmname | |
az vm open-port --resource-group rg_Name --name VMName --port 80 # allows any port type from any source to any destination | |
az vm image list --output table # list possible images available on azure for virtual machines | |
az vm image list --output table --all | |
az vm image list --output --offer windowsserver | |
#when creating a vm, URN can be mentioned which is specific version number for different available images in --images option |
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
#HANDS ON | |
#assigning IP address to linux system | |
ip address # shows the interfaces and IP address assigned to them | |
cd /etc/netplan # there's a yaml file here. Open it and configure the interface here | |
# File content after entering required details | |
network: | |
ethernets: | |
eno1: | |
dhcp4: false |
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
#check interfaces | |
get-netipinterface | |
#check ip address on the interface | |
ipconfig | |
#Disable dhcp on an interface | |
Set-NetIPInterface -InterfaceIndex 12 -Dhcp Disabled | |
#assign static ip to interface |
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
1. Open a cmd prompt with administrator credentials and run the This command will give us an output file export.txt that has all the user principal names and Immutable IDs of all objects that has UPN. | |
ldifde -f export.txt -r "(Userprincipalname=*)" -l "objectGuid, userPrincipalName" --- no need to change anything | |
Once you have the output, run export.txt, it will be exported to a notepad. Copy the Object GUID and proceed to step 3. | |
Notepad | |
The output looks like this for each object | |
---------------------------------------------------- | |
dn: CN=2013 OU=DirSynced OU DC=prakum DC=msftonlinerepro DC=com |
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
# Extend windows server evalution license | |
slmgr /rearm | |
# know the time until which the evalution edition is valid upto | |
Slmgr /dli | |
# Get the current edition | |
DISM /online /Get-CurrentEdition | |
# know the target editions to which the OS can be upgraded to |
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
#variables | |
$storageAccountName = 'storageacc' | |
$sasToken = 'sastoken' | |
$dateTime = get-date | |
# creating new context and define table | |
$storageCtx = New-AzStorageContext -StorageAccountName $storageAccountName -SasToken $sasToken | |
$tablename = (Get-AzStorageTable -Name $tableName -Context $storageCtx).Cloudtable | |
# setting partition key |
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
#Problem - windows client shows wrong time | |
#tried to adjust date/time > change date and time > Throws access denied error | |
#found the below commands to fix this: | |
net stop w32time | |
w32tm /unregister | |
w32tm /register | |
net start w32time | |
# Windows time service missing in services so the first command failed |
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
#Get folder statistics and check if mailbox is full. If in place archive is enabled, mailbox size in exchange admin centre and outlook | |
#is not correct. This command will show the stats | |
Get-MailboxFolderStatistics -Identity upn@domain.com -IncludeAnalysis -FolderScope RecoverableItems | Format-Table Name,ItemsInFolder,FolderSize,*Subject* | |
# grant mailbox access without automapping in outlook | |
# mailbox id2 is the user who will get access to the mailbox id1 | |
Add-MailboxPermission -Identity <Mailbox ID1> -User <Mailbox ID2> -AccessRights FullAccess -AutoMapping:$false |
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
#Find computers added to domain before 30 days | |
$limit = (get-date).adddays(-30) | |
$computers = get-adcomputer -Properties whencreated -Filter {whencreated -lt $limit} |
NewerOlder