Cannot Uninstall IoT Edge on Windows Server - powershell

I need to swap an IoT Edge device on Windows from one IoT Hub to another. I understand that current logic forces me to Uninstall IoT-Edge and install it again.
The problem is I get the following error trying to run this script:
{Invoke-WebRequest -useb aka.ms/iotedge-win} | Invoke-Expression; `
Uninstall-IoTEdge
I get this in return:
Invoke-Native : The term 'cmd' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1748 char:28
+ ... ersString = Invoke-Native "$dockerExe ps --all --format ""{{.ID}}""" ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (cmd:String) [Invoke-Native], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException,Invoke-Native
The Powershell is elevated as Admin. Am my missing some PATH variables? Any Ideas?

would you please run below commands in PowerShell window and share the results?
Get-Command "docker.exe"
Write-Host $env:ProgramFiles\iotedge-moby
check if the path exists or not.
do you know which version of iotedge service you installed? if the service is running, you can run "iotedge version" to find it out.

Thanks for the suggestion, but did manage to find workaround by removing docker with the help of this script:
https://success.docker.com/article/how-to-completely-remove-docker-in-windows-10
As fas as IOT Edge version it is 1.0.7 as 1.0.8. does not work in transparent gateway mode with Node-Red MQTT node (MS advised to wait for 1.0.9 where this bug will be fixed).

Related

"Add-UnifiedGroupLinks is not recognized.." even though ExchangeOnlineManagement 2.0.5 is definitely installed

I'm semi-new to PowerShell, so please excuse if I mix up some terminology. I need to manage M365-Groups via PS. I've inherited a productive machine which had a very old ExchangeOnlineModule installed (v. 0.4578.0). This version did allowed me to read the M365-Group members via get-unifiedGroupLinks -identity "zzz.test" -LinkType Members, but not to add members.
Next installed the latest productive version of the ExchangeOnlineMangement module according to MS' manual.
The command
Get-InstalledModule
shows me version 2.0.5.
The command
Get-Module -ListAvailable
shows both old an new version, installed in "Directory: C:\Program Files\WindowsPowerShell\Modules"
When I now try to run the following Add-command, I receive the error below:
Add-UnifiedGroupLinks -Identity "zzz.test" -LinkType Members -Links "mytestuser#mydomain.com"
Add-UnifiedGroupLinks : The term 'Add-UnifiedGroupLinks' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included,
verify that the path is correct and try again.
At line:1 char:1
+ Add-UnifiedGroupLinks -Identity "zzz.test" -LinkType Members -Link ...
+ ~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Add-UnifiedGroupLinks:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Same after I "manually" import that specific module version with "Import-Module".
Can anyone help me understand why this command works on my test machine, but is simply not recognized on this one? I already restarted that productive machine after the installation.
Thank you in advance & best regards
MK
Figured it with testing: The issue was insufficient access rights in AzureAD for the user used to connect to Exchange Online.
It would seem that the module only loads the commands for which you have the access rights to use into the connected session. Therefor, when you try to use such a command (like Add-UnifiedGroupLins) you get a "Term is not recognized" error, instead of something meaningfull.
For those who care: It worked for me after adding the Exchange administrator role and, obviously, with the Global administrator role. Maybe there is a lesser role that is sufficient, but I haven't found it.

databricks-cli installed, modules not visible

I installed the Databricks CLI, but I am unable to work with the library as such:
In powershell, I have set the working directory to: C:\Users\DNaught1\AppData\Local\Programs\Python\Python39\Scripts
I know the module is there:
Mode LastWriteTime Length Name
-a---- 13/10/2020 1:46 PM 74752 databricks.exe**
I then try to see the version but no luck as shown below:
PS C:\Users\DNaught1\AppData\Local\Programs\Python\Python39\Scripts> databricks --version
databricks : The term 'databricks' is not recognized as the name of a
cmdlet, function, script file, or operable program. Check the spelling
of the name, or if a path was included, verify that the path is
correct and try again. At line:1 char:1
databricks --version
+ CategoryInfo : ObjectNotFound: (databricks:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Suggestion [3,General]: The command databricks was not found, but does
exist in the current location. Windows PowerShell does not load
commands from the current location by default. If you trust this
command, instead type: ".\databricks". See "get-help
about_Command_Precedence" for more details.
I managed to work around it by using the following:
1- In Python use the command below to install the CLI module
package_names=['databricks-cli', 'requests'] #packages to install
pip.main(['install'] + package_names + ['--upgrade'])
2- In powershell cli:
change the context to the working directory:
Set-Location -Path C:\Users\DNaught1\AppData\Local\Programs\Python\Python39\Scripts
3 - Configure the databricks cli:
.\databricks.exe configure--token
.\databricks configure --token
Host: https://xxx.azuredatabricks.net
Token: dapi2b2dxxxxxxxxxa02c9e6866d322 - Access token for Secrets
4 - Write-host Configuration file for databricks access
Set-Content .databrickscfg "[DEFAULT]"
>> Add-Content .databrickscfg "host = https://xxx.azuredatabricks.net"
>> Add-Content .databrickscfg "token = dapi2b2dxxxxxxxxxa02c9e6866d322"
5 - Validate by checking file storage
.\dbfs ls

how connect to Azure Machine Learning Web service using PowerShell?

To use Azure Machine Learning Web service here you can find some sample code in C#, R, Python and JavaScript. I want to use it in PowerShell.
I found this tutorial, but when I am running bellow line of code, it will return error that it is not recognized:
Set-AzureMLWebServiceConnection -URI $Url -APIKey $API_key
Output:
Set-AzureMLWebServiceConnection : The term 'Set-AzureMLWebServiceConnection' is not recognized as the name of a cmdlet, function, script file, or operable
program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At C:\Users\Reza\Desktop\ndbench\Azure\Automation\01_get_metrics\add_target_to_tables - runbook_01.ps1:33 char:1
+ Set-AzureMLWebServiceConnection -URI $Url -APIKey $API_key
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Set-AzureMLWebServiceConnection:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
I can't found Set-AzureMLWebServiceConnection in my PowerShell command-list and I don't know how I can enable/install it.
Can you please guide me, how I can connect to Azure Machine Learning Web service using PowerShell?
The comment #gvee mentioned may be the best to use going forward though it is in beta.
However, to answer your question, use the Install-Module -Name AzureML command to get access to the Azure ML commands.

Error while deploying locally - Azure IOT remote monitoring suite

Team,
We are trying out this IOT remote monitoring suite from github. We are trying to first deploy that locally instead of Azure and hence we have followed the document mentioned here https://github.com/Azure/azure-iot-remote-monitoring/blob/master/Docs/local-deployment.md
Also, we have followed the pre-requisites over here https://github.com/Azure/azure-iot-remote-monitoring/blob/master/Docs/dev-setup.md
We then come over to my developer command prompt (running as admin) but we end up having error:
Get-AzureEnvironment : The 'Get-AzureEnvironment' command was found in
the module 'Azure', but the module could not be loaded. For more
information, r 'Import-Module Azure'. At
C:\Users\swagh\Downloads\azure-iot-remote-monitoring-master\azure-iot-re
-monitoring-master\Common\Deployment\PrepareIoTSample.ps1:14 char:14
+ if ((Get-AzureEnvironment AzureCloud) -eq $null)
+ ~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Get-AzureEnvironment:String) , CommandNotFoundException
+ FullyQualifiedErrorId : CouldNotAutoloadMatchingModule
Get-AzureRMEnvironment : The 'Get-AzureRMEnvironment' command was
found in module 'AzureRM', but the module could not be loaded. For
more information, run 'Import-Module AzureRM'.
The modules has been imported successfully but not sure why it fails while building the soln locally. Tried setting the execution policy to bypass, unrestricted. Also scoped to the current user but its not helping.
We have run out of ideas. Can anyone help please?
According to your error message, it seems you have not install Azure PowerShell correctly.
We can install download Azure PowerShell here. After download azure-powershell.4.2.0.msi completed, run as administrator.
We can find latest version of Azure powershell here.
We can run this command in Azure PowerShell version 4.2.0:
Azure error
The screenshot for the above error.

Windows Azure Powershell command Get-AzureWebsite results in error String was not recognized as a valid Boolean

I'm trying to manage some of my Azure Services via Powershell, using http://windowsazurewebsitescheatsheet.info/#powershell as a starting point. I was able to download and import my subscription settings just fine (Import-AzurePublishSettingsFile and Select-AzureSubscription)
After choosing my subscription, I'm attempting to run the Get-AzureWebsite command to view all of my websites, and continue onward from there. When I run that command, however, I get the following:
Import-AzurePublishSettingsFile "C:\AzureCredentials.publishsettings"
Select-AzureSubscription "My Azure Subscription"
Get-AzureWebsite
Get-AzureWebsite : String was not recognized as a valid Boolean.
At line:1 char:1
+ Get-AzureWebsite
+ ~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Get-AzureWebsite], FormatException
+ FullyQualifiedErrorId : Microsoft.WindowsAzure.Commands.Websites.GetAzureWebsiteCommand
Anyone have similar issues? I get this error if I run the command as stated above, or if I specify the name of my website. TIA for any help!
This might be related to a known issue enumerating a sites with SSL bindings
There was new release of Windows Azure Powershell released on 02/12. Please try with the new version.
Please run the command again with -Debug turned on, this will display request and response messages and make it easier to pinpoint the issue.