I’ve seen a few times, where someone needs a new username in office365. Sometimes it happens from the Service Desk doing a typo in a user account creation and it syncs up to AzureAD from onpremise AD and sometimes its because of a relationship change. Now, if you’re syncing from AzureAD you’ll see when you click Manage Username, a warning that this change must happen from Onpremise AD because it’s

Ever need a quick randomly generated password? Here’s a quick bit of code for that.   $RandomCharacters = ]"abcdefghijkmnopqrstuvwxyzABCEFGHJKLMNPQRSTUVWXYZ23456789!#%&/()=?" $RandomPW = ($RandomCharacters | Get-Random -Count 16) -join "" $RandomPW

Every once in a while, I need to have a nice way to monitor progress of a script. I used to add write-host messages and echo variables back so I could see counters – but, there’s progress bars for that. This is how you use them. #Progress bars for scripts # A Quick Array to have data $fruit = @('Apples','Oranges','Bananas') # # Main Activity is -Activity. Subtasks are -id 1

Well, it’s been some time since I decided I need to create Azure scripts for powering off and starting up VMs.  It’s probably been in my backlog over 2 years, but time’s escaped me. I’ve seen a few scripts that do parts of what I wanted to do and I’ve tried some that burnt through all the free processing time you get with an automation account, so I built my

Does PowerShell Truncate your output? Say for example you’re looking at output: ProxyAddresses: STMP: [email protected], smtp: [email protected], smtp: [email protected]… DOT>DOT>DOT!!!! Annoying right. Well, fix that with the following: $formatenumerationlimit =-1

Here’s a quick one. Azure Storage tables. I have a function that is called Add-Entity that will add rows to the table and the powershell that does the lifting. # Function Add-Entity: Adds an employee entity to a table function Add-Entity() { param( $table, $partitionKey, $rowKey, $name, $id ) $entity = New-Object -TypeName Microsoft.WindowsAzure.Storage.Table.DynamicTableEntity -ArgumentList $partitionKey $rowKey $entity.Properties.Add("Name", $name) $entity.Properties.Add("ID", $id) #Entity is new data row inserted into table

New to Message queues in Azure? Here’s some samples for working with them. #Azure Message Queue Manipulation $StorageAccountName = "storage001" $StorageAccountKey = Get-AzureRMStorageAccountKey -StorageAccountName $StorageAccountName -ResourceGroupName "Storage" $storeAuthContext = New-AzureStorageContext $StorageAccountName -StorageAccountKey $StorageAccountKey.value # Create Queue $myQueue = New-AzureStorageQueue -Name 'myqueue' -Context $storeAuthContext # Create Queue Message $queueMessage = New-Object -TypeName Microsoft.WindowsAzure.Storage.Queue.CloudQueueMessage -ArgumentList 'Hello' #Can run next line a few times in a row to fill queue with data $myQueue.CloudQueue.AddMessage($queueMessage)

Sometimes you just need to get a list of all your users and the last time they set their passwords. This is a pretty quick and dirty way to do it. $reportObject = @() $userList = Get-ADUser -filter {Enabled -eq $True -and PasswordNeverExpires -eq $False} -Properties "DisplayName", "LastLogonTimeStamp", "LastLogonDate", "PasswordLastSet", "msDS-UserPasswordExpiryTimeComputed" | Where-Object {$_.DisplayName -ne $null} $userList | %{ $output = "" | Select DisplayName, passwordlastset, ExpiryDate, LastLogonDate $output.DisplayName =

Quick steps to deploy your first Azure RM based VM utilizing PowerShell. # Step 1 - Login Add-AzureAccount Login-AzureRMAccount # Step 2 - create a resource group $locName = "centralus" $rgName = "PowerShellVM" # Step 3 - Create a storage account $stName = "hscjhstore01" Get-AzureRMStorageAccountNameAvailability $stName $storageAcc = New-AzureRMStorageAccount -ResourceGroupName $rgName -Name $stName -SkuName "Standard_LRS" -Kind "Storage" -Location $locName $ Step 4 - Configure networking $subnetName = "VMSubnet" $ipName =