Azure-docs: powershell script fails

Created on 23 May 2019  Â·  10Comments  Â·  Source: MicrosoftDocs/azure-docs

[Enter feedback here]


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

ascforiosvc assigned-to-author doc-bug in-progress triaged

Most helpful comment

@kartheekakkur Thanks for providing your results. The product engineers are now trying to understand the issue and we will revert back as quickly as possible.

All 10 comments

@kartheekakkur Thanks for the feedback! Would you please provide a little more detail like a what step of the tutorial you got the issue. Also would you please share the errors you are getting?

Hi @kartheekakkur Do you have any updates? Would you please share the errors and the step at what you got stuck?

@Alberto-Vega-MSFT

Here is the issue

Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

PS C:Userskakkur> cd C:scriptsAzure-IoT-Security-Agent-CS-mastersrcModulesSecurityWindowsInstall
PS C:scriptsAzure-IoT-Security-Agent-CS-mastersrcModulesSecurityWindowsInstall> .InstallSecurityAgent.ps1 -Insta
ll -aui Device -aum SelfSignedCertificate -f C:Userskakkurcm1Cert -hn KeyScaler-IoTHub.azure-devices.net -di IOT-dev
ice5.iot.net -cl LocalFile
Exception calling "Load" with "1" argument(s): "Root element is missing."
At C:scriptsAzure-IoT-Security-Agent-CS-mastersrcModulesSecurityWindowsInstallInstallSecurityAgent.ps1:84
char:2

  • [System.Xml.Linq.XDocument]$authenticationXmlDoc = [System.Xml.Li ...
  • ~~~~~~~~~~~~~

    • CategoryInfo : NotSpecified: (:) [], MethodInvocationException

    • FullyQualifiedErrorId : XmlException

Exception calling "XPathEvaluate" with "2" argument(s): "Value cannot be null.
Parameter name: node"
At C:scriptsAzure-IoT-Security-Agent-CS-mastersrcModulesSecurityWindowsInstallInstallSecurityAgent.ps1:71
char:5

  • $node = [System.Xml.XPath.Extensions]::XPathEvaluate($xmlDoc.Root ...
  • ~~~~~~~~~~~~~

    • CategoryInfo : NotSpecified: (:) [], MethodInvocationException

    • FullyQualifiedErrorId : ArgumentNullException

You cannot call a method on a null-valued expression.
At C:scriptsAzure-IoT-Security-Agent-CS-mastersrcModulesSecurityWindowsInstallInstallSecurityAgent.ps1:72
char:2

  • $node.SetValue($value)
  • ~~~~~~

    • CategoryInfo : InvalidOperation: (:) [], RuntimeException

    • FullyQualifiedErrorId : InvokeMethodOnNull

Exception calling "XPathEvaluate" with "2" argument(s): "Value cannot be null.
Parameter name: node"
At C:scriptsAzure-IoT-Security-Agent-CS-mastersrcModulesSecurityWindowsInstallInstallSecurityAgent.ps1:71
char:5

  • $node = [System.Xml.XPath.Extensions]::XPathEvaluate($xmlDoc.Root ...
  • ~~~~~~~~~~~~~

    • CategoryInfo : NotSpecified: (:) [], MethodInvocationException

    • FullyQualifiedErrorId : ArgumentNullException

You cannot call a method on a null-valued expression.
At C:scriptsAzure-IoT-Security-Agent-CS-mastersrcModulesSecurityWindowsInstallInstallSecurityAgent.ps1:72
char:2

  • $node.SetValue($value)
  • ~~~~~~

    • CategoryInfo : InvalidOperation: (:) [], RuntimeException

    • FullyQualifiedErrorId : InvokeMethodOnNull

Exception calling "XPathEvaluate" with "2" argument(s): "Value cannot be null.
Parameter name: node"
At C:scriptsAzure-IoT-Security-Agent-CS-mastersrcModulesSecurityWindowsInstallInstallSecurityAgent.ps1:71
char:5

  • $node = [System.Xml.XPath.Extensions]::XPathEvaluate($xmlDoc.Root ...
  • ~~~~~~~~~~~~~

    • CategoryInfo : NotSpecified: (:) [], MethodInvocationException

    • FullyQualifiedErrorId : ArgumentNullException

You cannot call a method on a null-valued expression.
At C:scriptsAzure-IoT-Security-Agent-CS-mastersrcModulesSecurityWindowsInstallInstallSecurityAgent.ps1:72
char:2

  • $node.SetValue($value)
  • ~~~~~~

    • CategoryInfo : InvalidOperation: (:) [], RuntimeException

    • FullyQualifiedErrorId : InvokeMethodOnNull

Exception calling "XPathEvaluate" with "2" argument(s): "Value cannot be null.
Parameter name: node"
At C:scriptsAzure-IoT-Security-Agent-CS-mastersrcModulesSecurityWindowsInstallInstallSecurityAgent.ps1:71
char:5

  • $node = [System.Xml.XPath.Extensions]::XPathEvaluate($xmlDoc.Root ...
  • ~~~~~~~~~~~~~

    • CategoryInfo : NotSpecified: (:) [], MethodInvocationException

    • FullyQualifiedErrorId : ArgumentNullException

You cannot call a method on a null-valued expression.
At C:scriptsAzure-IoT-Security-Agent-CS-mastersrcModulesSecurityWindowsInstallInstallSecurityAgent.ps1:72
char:2

  • $node.SetValue($value)
  • ~~~~~~

    • CategoryInfo : InvalidOperation: (:) [], RuntimeException

    • FullyQualifiedErrorId : InvokeMethodOnNull

Exception calling "XPathEvaluate" with "2" argument(s): "Value cannot be null.
Parameter name: node"
At C:scriptsAzure-IoT-Security-Agent-CS-mastersrcModulesSecurityWindowsInstallInstallSecurityAgent.ps1:71
char:5

  • $node = [System.Xml.XPath.Extensions]::XPathEvaluate($xmlDoc.Root ...
  • ~~~~~~~~~~~~~

    • CategoryInfo : NotSpecified: (:) [], MethodInvocationException

    • FullyQualifiedErrorId : ArgumentNullException

You cannot call a method on a null-valued expression.
At C:scriptsAzure-IoT-Security-Agent-CS-mastersrcModulesSecurityWindowsInstallInstallSecurityAgent.ps1:72
char:2

  • $node.SetValue($value)
  • ~~~~~~

    • CategoryInfo : InvalidOperation: (:) [], RuntimeException

    • FullyQualifiedErrorId : InvokeMethodOnNull

Exception calling "XPathEvaluate" with "2" argument(s): "Value cannot be null.
Parameter name: node"
At C:scriptsAzure-IoT-Security-Agent-CS-mastersrcModulesSecurityWindowsInstallInstallSecurityAgent.ps1:71
char:5

  • $node = [System.Xml.XPath.Extensions]::XPathEvaluate($xmlDoc.Root ...
  • ~~~~~~~~~~~~~

    • CategoryInfo : NotSpecified: (:) [], MethodInvocationException

    • FullyQualifiedErrorId : ArgumentNullException

You cannot call a method on a null-valued expression.
At C:scriptsAzure-IoT-Security-Agent-CS-mastersrcModulesSecurityWindowsInstallInstallSecurityAgent.ps1:72
char:2

  • $node.SetValue($value)
  • ~~~~~~

    • CategoryInfo : InvalidOperation: (:) [], RuntimeException

    • FullyQualifiedErrorId : InvokeMethodOnNull

Exception calling "XPathEvaluate" with "2" argument(s): "Value cannot be null.
Parameter name: node"
At C:scriptsAzure-IoT-Security-Agent-CS-mastersrcModulesSecurityWindowsInstallInstallSecurityAgent.ps1:71
char:5

  • $node = [System.Xml.XPath.Extensions]::XPathEvaluate($xmlDoc.Root ...
  • ~~~~~~~~~~~~~

    • CategoryInfo : NotSpecified: (:) [], MethodInvocationException

    • FullyQualifiedErrorId : ArgumentNullException

You cannot call a method on a null-valued expression.
At C:scriptsAzure-IoT-Security-Agent-CS-mastersrcModulesSecurityWindowsInstallInstallSecurityAgent.ps1:72
char:2

  • $node.SetValue($value)
  • ~~~~~~

    • CategoryInfo : InvalidOperation: (:) [], RuntimeException

    • FullyQualifiedErrorId : InvokeMethodOnNull

You cannot call a method on a null-valued expression.
At C:scriptsAzure-IoT-Security-Agent-CS-mastersrcModulesSecurityWindowsInstallInstallSecurityAgent.ps1:98
char:5

  • $authenticationXmlDoc.Save($xStream)
  • ~~~~~~~~

    • CategoryInfo : InvalidOperation: (:) [], RuntimeException

    • FullyQualifiedErrorId : InvokeMethodOnNull

C:scriptsAzure-IoT-Security-Agent-CS-mastersrcModulesSecurityWindowsInstall/InstallAgent.ps1 : The term
'C:scriptsAzure-IoT-Security-Agent-CS-mastersrcModulesSecurityWindowsInstall/InstallAgent.ps1' 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

  • C:scriptsAzure-IoT-Security-Agent-CS-mastersrcModulesSecurityWi ...
  • ~~~~~~~~~~~~~~~~~

    • CategoryInfo : ObjectNotFound: (C:scriptsAzur...nstallAgent.ps1:String) [], CommandNotFoundException

    • FullyQualifiedErrorId : CommandNotFoundException

@kartheekakkur Thanks for providing your results. The product engineers are now trying to understand the issue and we will revert back as quickly as possible.

@kartheekakkur It’s seems to be either a permissions issue or the config file is corrupted.
Can you confirm you are running the script as Administrator, and that you have permissions to the directory the files are located in?

@mlottner Yes I ran the poweshell with admin permissions and I manually pasted the values in the config file it was referring to as well, its I had the issues.

Method invocation failed because [System.Xml.XPath.XPathEvaluator+d__1`1[[System.Object, mscorlib,
Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]] does not contain a method named 'SetValue'.
At C:scriptsAzure-IoT-Security-Agent-CS-mastersrcModulesSecurityWindowsInstallInstallSecurityAgent.ps1:72
char:2

  • $node.SetValue($value)
  • ~~~~~~

    • CategoryInfo : InvalidOperation: (:) [], RuntimeException

    • FullyQualifiedErrorId : MethodNotFound

C:scriptsAzure-IoT-Security-Agent-CS-mastersrcModulesSecurityWindowsInstall/InstallAgent.ps1 : The term
'C:scriptsAzure-IoT-Security-Agent-CS-mastersrcModulesSecurityWindowsInstall/InstallAgent.ps1' 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

  • C:scriptsAzure-IoT-Security-Agent-CS-mastersrcModulesSecurityWi ...
  • ~~~~~~~~~~~~~~~~~

    • CategoryInfo : ObjectNotFound: (C:scriptsAzur...nstallAgent.ps1:String) [], CommandNotFoundException

    • FullyQualifiedErrorId : CommandNotFoundException

@kartheekakkur, it seems that you care trying to run the scripts from their location in the repository, while they are intended to run after you build the solution.

  1. Navigate to srcModulesSecurity
  2. Run dotnet publish –c -r
  3. Go to the install directory that is under the output folder here: srcModulesSecuritybinnetcoreapp2.0publishInstall
  4. Run the install scripts from there according to the docs

@kartheekakkur Please let us know if the latest instructions from @kfbehar helped and you have now succeeded, or if you still need assistance.

@mlottner @kfbehar

the link does not work https://docs.microsoft.com/en-us/dotnet/core/rid-catalog%3E

@kartheekakkur Try this: .NET Core RID Catalog

Was this page helpful?
0 / 5 - 0 ratings