{"id":27633793,"url":"https://github.com/djaus2/azureiot-coreutils","last_synced_at":"2025-09-05T02:42:05.013Z","repository":{"id":85177278,"uuid":"166129569","full_name":"djaus2/AzureIoT-CoreUtils","owner":"djaus2","description":"Some PowerShell scripts for setting up conatainers on Win 10 IoT-Core","archived":false,"fork":false,"pushed_at":"2019-02-15T03:36:32.000Z","size":149,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-06-24T10:11:41.566Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PowerShell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/djaus2.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2019-01-16T23:53:06.000Z","updated_at":"2020-03-30T01:00:35.000Z","dependencies_parsed_at":"2023-03-30T05:34:34.146Z","dependency_job_id":null,"html_url":"https://github.com/djaus2/AzureIoT-CoreUtils","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/djaus2/AzureIoT-CoreUtils","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/djaus2%2FAzureIoT-CoreUtils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/djaus2%2FAzureIoT-CoreUtils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/djaus2%2FAzureIoT-CoreUtils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/djaus2%2FAzureIoT-CoreUtils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/djaus2","download_url":"https://codeload.github.com/djaus2/AzureIoT-CoreUtils/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/djaus2%2FAzureIoT-CoreUtils/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273703395,"owners_count":25152999,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-05T02:00:09.113Z","response_time":402,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-04-23T18:19:51.888Z","updated_at":"2025-09-05T02:41:59.996Z","avatar_url":"https://github.com/djaus2.png","language":"PowerShell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AzureIoT-CoreUtils\nSome PowerShell scripts for setting up containers on Win 10 IoT-Core\n\n\n\u003e\u003e Nb: On Windows 10 IoT-Core you need a 64 bit version of the OS and so won't current run Containers on the RPI.  I am using a MinnowBoardMax. I have run the Az Edge container examples on Raspberry PI running Raspian. They might work on an NXP IOT-Core (ARM64) device ??\n\n\nWhen deploying Azure IoTEdge Containers to a Windows 10 IoT-Core device, the Azure cLI commands need to be a little different to those stated in some of the Azure IoT Hub documentation.  In particular, setting installing and uninstaling requires a local PowerShell script; that is, one copied to the device. I have been working through the tutorials such as:\n- [Quickstart: Deploy your first IoT Edge module from the Azure portal to a Windows device - preview](https://docs.microsoft.com/en-us/azure/iot-edge/quickstart)\n- [Tutorial: Develop a C# IoT Edge module and deploy to your simulated device](https://docs.microsoft.com/en-us/azure/iot-edge/tutorial-csharp-module)\n\nI found that in \"Install and start the IoT Edge runtime/Download and install the IoT Edge service\", Step 2 doesn't work if targeting an IoT-Core device. The following is the Step 2 comamnd that won't work:\n\n```\n. {Invoke-WebRequest -useb aka.ms/iotedge-win} | Invoke-Expression; `\nInstall-SecurityDaemon -Manual -ContainerOs Windows\n```\n\nThere was some discussion of this issue with a workaround presented.  The PowerShell scripts presented here are a formal encapsulation of that solution.\n- [My discussion thread on MS Docs on this issue](https://github.com/MicrosoftDocs/azure-docs/issues/21915)\n\nPivotal was this response from Kelly Gremban @kgremban:\n\u003eFor unblocking your most recent status update, I've heard from some other users that the current installation bits are buggy on IoT Core. Download [IotEdgeSecurityDaemon.ps1](https://raw.githubusercontent.com/alextnewman/iotedge/3b87d6805fed1e2bdc74dc6f2d3f45cfea328b3e/scripts/windows/setup/IotEdgeSecurityDaemon.ps1) and save it locally on your machine.\n\nAnd the command to invoke it locally is given by @sergaz-msft at\n https://github.com/MicrosoftDocs/azure-docs/issues/21559#issuecomment-451163574  as\n \n ```\n \"C:\\locationofthescript\\IotEdgeSecurityDaemon.ps1\" | Invoke-Expression; ` \nInstall-SecurityDaemon -Manual -ContainerOs Windows\n```\n\nI have created a couple of scripts to simplify the script's use and added some scripts for logging.\n\n## PowerShell scripts to be run on IoT-Core Device\n*Usage:* Copy these scripts to (say) c:\\iotedge on your IoT-Core device. Then run on the device through the PowerShell portal to the device\n- install.ps1: Installation script to replace Step 2 above\n- uninstall.ps1: Removal script \n- IotEdgeSecurityDaemon.ps1: This is called by the install and uninstall scripts as per the link from Kelly above.\n- log-min.ps1: Requires a parameter m, number of minutes. Show log for last m minutes (eg ./logmin 5) \n- log-sec.ps1: Requires a parameter s, number of seconds. Show log for last s seconds (eg ./logsec 3) \n- log-last5min.ps1: Show log for last 5 minutes\n- log-last30sec.ps1: Show log for last 30 seconds.\n- log-loop.ps1:  Loops (every 29 secs) dispaly logs for last 30 sec and runs ```iotedge list```\n- ftp.ps1: Start ftp daemon on device\n- GetServices.ps1: Get list of running services\n- The next three were trials. Use restart-rm.ps1\n- restart.ps1\n- restart-iotedge.ps1\n- restart-withcs.ps1\n- **restart-rm.ps1: Does quick restart of IoTEdge**\n- dokker.ps1: For docker commands when using moby. Inserts the required npipe.\n\n\n## PowerShell ISE\nRun **PowerShell ISE** on your dev machine as your PS console to your device, rather than PowerShell.  \nIt gives you an editor for your scripts.  Use the following script on your dev machine:\n- remoteme.ps1\n\n***Note:*** Edit the $machine variable in the script first\n\n\n*The following assumes you have established a PowerShell window to the device, eg via IoT Dashboard and copied the scripts to a suitable folder and changed to that folder at the prompt.*\n\n### Running the Install script\nGet the Connection string as per the tutorial documentation, then enter the call to the script eg:\n```\n[192.168.0.26]: PS C:\\iotedge\u003e .\\install\n\nModuleType Version    Name                                ExportedCommands\n---------- -------    ----                                ----------------\nScript     0.0        IotEdgeSecurityDaemon               {Install-SecurityDaemon, Uninstall-SecurityDaemon}\n\ncmdlet Install-SecurityDaemon at command pipeline position 1\nSupply values for the following parameters:\nDeviceConnectionString:\n```\n*Enter Connection string here when prompted*\n \n```\nThe container host is on supported build version 17763.\nDownloading Moby Engine...\nUsing Moby Engine from C:\\Data\\Users\\administrator\\AppData\\Local\\Temp\\iotedge-moby-engine.zip\nDownloading Moby CLI...\nUsing Moby CLI from C:\\Data\\Users\\administrator\\AppData\\Local\\Temp\\iotedge-moby-cli.zip\nDownloading IoT Edge security daemon...\nUsing IoT Edge security daemon from C:\\Data\\Users\\administrator\\AppData\\Local\\Temp\\iotedged-windows.zip\nSkipping VC Runtime installation on IoT Core.\nGenerating config.yaml...\nConfigured device for manual provisioning.\nConfigured device with hostname 'minwinpcMax'.\nConfigured device with Moby Engine URL 'npipe://./pipe/iotedge_moby_engine'.\nUpdated system PATH.\nAdded IoT Edge registry key.\nInitialized the IoT Edge service.\n```\n\n\u003e\u003e NB: At this stage, the job isn't done! The device is still setting up. Look at the logs until things settle.\n\nYou should see logs such as \n\n```\n16/01/2019 4:03:23 PM info: edgelet_docker::runtime -- Successfully pulled image\n                      mcr.microsoft.com/azureiotedge-agent:1.0\n16/01/2019 4:03:23 PM info: edgelet_docker::runtime -- Creating module edgeAgent...\n16/01/2019 4:03:23 PM info: edgelet_docker::runtime -- Successfully created module edgeAgent\n16/01/2019 4:03:23 PM info: edgelet_docker::runtime -- Starting module edgeAgent...\n16/01/2019 4:03:33 PM info: edgelet_docker::runtime -- Successfully started module edgeAgent\n16/01/2019 4:03:33 PM info: edgelet_core::watchdog -- Checking edge runtime statusedge\n16/01/2019 4:03:33 PM info: edgelet_core::watchdog -- Edge runtime is running.\n```\n..and similar for edgehub, tempSensor and CSharpModule.\nEventually ```iotedge list``` will show them all running:\n\n```\n[192.168.0.26]: PS C:\\iotedge\u003e iotedge list\nNAME             STATUS           DESCRIPTION      CONFIG\nCSharpModule     running          Up 37 minutes    djauscontainerreg.azurecr.io/csharpmodule:0.0.1-windows-amd64\ntempSensor       running          Up 38 minutes    mcr.microsoft.com/azureiotedge-simulated-temperature-sensor:1.0\nedgeHub          running          Up 38 minutes    mcr.microsoft.com/azureiotedge-hub:1.0\nedgeAgent        running          Up 39 minutes    mcr.microsoft.com/azureiotedge-agent:1.0\n```\n\n### Running the Log scripts\neg\n\n```\n    ./log-min 10 Show log for 5 last 10 minutes\n    ./log-sec 20 Show log for last 20 seconds\n    ./log-last5min Show log for last 5 minutes\n    ./log-last30sec: Show log for last 30 seconds.\n ```  \n\n\n### Running the UnInstall script\n*Note that this take quite a while before it is done.*\n\n```\n[192.168.0.26]: PS C:\\iotedge\u003e .\\uninstall\n\nModuleType Version    Name                                ExportedCommands\n---------- -------    ----                                ----------------\nScript     0.0        IotEdgeSecurityDaemon               {Install-SecurityDaemon, Uninstall-SecurityDaemon}\nUninstalling...\nDeleting install directory 'C:\\ProgramData\\iotedge'...\nDeleting Moby data root directory 'C:\\Data\\ProgramData\\iotedge-moby-data'...\nSuccessfully uninstalled IoT Edge.\n```\n\n## New Container Download (ie Updates)\nI found that when working with the tutorial:\n[Tutorial: Develop a C# IoT Edge module and deploy to your simulated device](https://docs.microsoft.com/en-us/azure/iot-edge/tutorial-csharp-module)\nif I updated my module and attempted an updated download, the update didn't make it to the device. The documentation says that existing modules are stopped and new image/s replace existing containers on the target. I found this didn't happen. Whilst I am looking for a better solution, I found that if I Unistall then Install again and then redeploy, then updates make it to the device.\n\n_**Simpler**_: Use restart-rm.ps1 as above\n\n## Restarting device: IOT-Core\nAnother issue has surfaced: **If you reboot an IoT-Core device running Az IoT Edge, the containers don't restart, except, maybe, the Agent**.  From Feedback:\n\n  _After installation, all runs fine. But after every reboot the edgeAgent does not find its network anymore and thus fails to start the modules. It looks like the “azure-iot-edge” network is recreated on every docker restart with a different id. But the edge containers do not get notified about this by the daemon._\n\n\nAfter reboot just run the **restart-rm.ps1*** script and it will re-pull those containers. NB: The old images are still on the device so some cleanup may be required. It is expected that this issue is to be addressed in an updated image.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdjaus2%2Fazureiot-coreutils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdjaus2%2Fazureiot-coreutils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdjaus2%2Fazureiot-coreutils/lists"}