How To Copy Logs From A Windows Device To The Cloud (Azure Blob Storage)
This method can either be used during a Task Sequence or in the Run Script feature in ConfigMgr/Intune.
Login to your Azure Portal (click here )and search for Storage Accounts and open it. (This blog won't cover on how to create a Storage Account, but will be covered on a later post or if requested)
Choose a Storage Account you would like to use or create a new one. (All Storage Accounts have been blanked out for security reasons)
Click on Containers in the right hand pane
Right Click on 'Blob Containers' and choose 'Create blob container'.
Give it a name and Click Create. In this blog, we will call it test-logs
Find the Container by using the Search Box above it.
You will be presented with the URI and Query String for it. Copy the Query String to be used at a later stage.
Now we are going to copy the required modules from a device that has it installed already to our Azure Blob Storage so that it can be downloaded when ran as Run Script or during a Task Sequence
On your own/VM device, install the module required. Open Powershell as admin and run the following command
Install-Module azure.storage -Confirm:$False -Force
Now go to your Azure Blob Storage Container created earlier (test-logs), and click Upload on the top ribbon
Once the file has been uploaded, Right Click on it and choose 'Get Shared Access Signature' and change the expiry date to a time in the very far future. Leave everything else as default.
Now to the script part, big thanks to Tom Degreef - https://www.oscc.be/sccm/Logging-in-the-cloud-Part-1/
The script can be downloaded from here . Just replace the 4 values with your ones and it should be good to go. $url , StorageAccountName , storSas and container
$url is the URI for the Azure-Modules.zip we generate above.
StorageAccountName is the name of the storage account.
StoreSas is the Query String we generated for the container test-logs above.
Container is the name of the container, in our case test-logs
How the first part of the script works?
Basically, it will check if you have the modules installed already. If you do, it will skip the rest and go to Import the module directly. If you don't have the modules installed, it will download it from the Azure Blob Storage, unzip it to C:\Program Files\WindowsPowershell\Modules and then import it.
My solution doesn't require any packages to be deployed to the machine beforehand. It's a one script shop, which will download the modules from the Blob Storage if it doesn't exist.
This solution works with both the Run Script feature in ConfigMgr/Intune and in a Task Sequence.
Add as a script in ConfigMgr
Go to Software Library and click Scripts
Copy Paste the script from my GitHub and following the instructions on screen. Don't forget to approve the script.
Find the device you want to run the Script on. Right click on the device > Run Script
That's it for now, until next time.
Play The Best Slot Games Online - Lucky Club
ReplyDeletePlay The Best Slot Games Online with Lucky Club, the home to progressive jackpots, luckyclub.live bingo, blackjack, video poker, live dealer and more!
Casino de Drmcd
ReplyDelete› › 김해 출장샵 Casino De Drmcd · Location & 문경 출장마사지 timings · In addition 김제 출장안마 to 부산광역 출장샵 creating a 청주 출장안마 fun environment, the Casino de Drmcd Hotel & Spa has an outdoor pool. · Health, safety and security