title: PowerShell, The term 'xxxxxx' is not recognized as the name of a cmdlet
body: <p>So i have the following PowerShell script that installs a third-party add-on in a program called M-Files.
  This script worked perfect a couple days ago, then i tried to run it today without changing anything and it gave me a couple of errors as shown below.</p>
  
  <p>I'm new to this so I did some research and did not find anything that helped..</p>
  
  <p><strong>FYI:</strong>
  Tried to do <a href="https://stackoverflow.com/questions/34847849/powershell-build-in-function-not-recognized-as-the-name-of-a-cmdlet">this</a> solution and that did not help, I have no PowerShell processors running so I'm not hitting any limit.</p>
  
  <p>Script:</p>
  
  <pre><code># Application details
  $appFilePath = "bin\Debug\ACV.mfappx"
  $appGuid = "e9982d4b-e705-4016-a99c-dfd4bbe3fadc"
  
  # Target vault
  $vaultName = "IDIRMEGA"
  
  # Connection details 
  $authType = 1 # 1 = MFAuthTypeLoggedOnWindowsUser
  $userName = ""
  $password = ""
  $domain = ""
  $spn = ""
  $protocolSequence = "ncacn_ip_tcp"
  $networkAddress = "localhost"
  $endpoint = 2266
  $encryptedConnection = $false
  $localComputerName = ""
  
  Write-Host "Connecting to Vault..."
  
  # Load M-Files API
  $null = [System.Reflection.Assembly]::LoadWithPartialName("Interop.MFilesAPI")
  
  # Connect to M-Files Server
  $server = new-object MFilesAPI.MFilesServerApplicationClass
  $tzi = new-object MFilesAPI.TimeZoneInformationClass
  $tzi.LoadWithCurrentTimeZone()
  $null = $server.ConnectAdministrativeEx( $tzi, $authType, $userName, $password, $domain, $spn, $protocolSequence, $networkAddress, $endpoint, $encryptedConnection, $localComputerName )
  
  # Get the target vault
  $vaultOnServer = $server.GetOnlineVaults().GetVaultByName( $vaultName )
  
  # Login to vault
  $vault = $vaultOnServer.LogIn()
  
  # Try to uninstall existing application
  try
  {
      Write-Host "Checking for previous installation of ACV..."
  
      # Uninstall
      $vault.CustomApplicationManagementOperations.UninstallCustomApplication( $appGuid );
  
      Write-Host "Restarting after uninstall..."
  
      # Restart vault. The installation seems to fail, if the vault is not restarted after uninstall.
      $server.VaultManagementOperations.TakeVaultOffline( $vaultOnServer.GUID, $true )
      $server.VaultManagementOperations.BringVaultOnline( $vaultOnServer.GUID )
  
      # Login to vault again.
      $vault = $vaultOnServer.LogIn()
  }
  catch {}
  
  Write-Host "Installing ACV..."
  
  # Install application. The vault should not have the application installed at this point.
  $vault.CustomApplicationManagementOperations.InstallCustomApplication( $appFilePath )
  
  Write-Host "Restarting after install..."
  
  # Restart vault
  $server.VaultManagementOperations.TakeVaultOffline( $vaultOnServer.GUID, $true )
  $server.VaultManagementOperations.BringVaultOnline( $vaultOnServer.GUID )
  </code></pre>
  
  <p>Error:</p>
  
  <pre><code>1&gt;  Write-Host : The term 'Write-Host' is not recognized as the name of a cmdlet, function, script file, or operable progra
  1&gt;  m. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
  1&gt;  At C:\Users\Konica Minolta\source\repos\ACV\ACV\install-application.ps1:20 char:1
  1&gt;  + Write-Host "Connecting to Vault..."
  1&gt;  + ~~~~~~~~~~
  1&gt;      + CategoryInfo          : ObjectNotFound: (Write-Host:String) [], CommandNotFoundException
  1&gt;      + FullyQualifiedErrorId : CommandNotFoundException
  1&gt;   
  1&gt;  new-object : The term 'new-object' is not recognized as the name of a cmdlet, function, script file, or operable progra
  1&gt;  m. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
  1&gt;  At C:\Users\Konica Minolta\source\repos\ACV\ACV\install-application.ps1:26 char:11
  1&gt;  + $server = new-object MFilesAPI.MFilesServerApplicationClass
  1&gt;  +           ~~~~~~~~~~
  1&gt;      + CategoryInfo          : ObjectNotFound: (new-object:String) [], CommandNotFoundException
  1&gt;      + FullyQualifiedErrorId : CommandNotFoundException
  1&gt;   
  1&gt;  new-object : The term 'new-object' is not recognized as the name of a cmdlet, function, script file, or operable progra
  1&gt;  m. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
  1&gt;  At C:\Users\Konica Minolta\source\repos\ACV\ACV\install-application.ps1:27 char:8
  1&gt;  + $tzi = new-object MFilesAPI.TimeZoneInformationClass
  1&gt;  +        ~~~~~~~~~~
  1&gt;      + CategoryInfo          : ObjectNotFound: (new-object:String) [], CommandNotFoundException
  1&gt;      + FullyQualifiedErrorId : CommandNotFoundException
  1&gt;   
  1&gt;  You cannot call a method on a null-valued expression.
  1&gt;  At C:\Users\Konica Minolta\source\repos\ACV\ACV\install-application.ps1:28 char:1
  1&gt;  + $tzi.LoadWithCurrentTimeZone()
  1&gt;  + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1&gt;      + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
  1&gt;      + FullyQualifiedErrorId : InvokeMethodOnNull
  1&gt;   
  1&gt;  You cannot call a method on a null-valued expression.
  1&gt;  At C:\Users\Konica Minolta\source\repos\ACV\ACV\install-application.ps1:29 char:1
  1&gt;  + $null = $server.ConnectAdministrativeEx( $tzi, $authType, $userName,  ...
  1&gt;  + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1&gt;      + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
  1&gt;      + FullyQualifiedErrorId : InvokeMethodOnNull
  1&gt;   
  1&gt;  You cannot call a method on a null-valued expression.
  1&gt;  At C:\Users\Konica Minolta\source\repos\ACV\ACV\install-application.ps1:32 char:1
  1&gt;  + $vaultOnServer = $server.GetOnlineVaults().GetVaultByName( $vaultName ...
  1&gt;  + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1&gt;      + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
  1&gt;      + FullyQualifiedErrorId : InvokeMethodOnNull
  1&gt;   
  1&gt;  You cannot call a method on a null-valued expression.
  1&gt;  At C:\Users\Konica Minolta\source\repos\ACV\ACV\install-application.ps1:35 char:1
  1&gt;  + $vault = $vaultOnServer.LogIn()
  1&gt;  + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1&gt;      + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
  1&gt;      + FullyQualifiedErrorId : InvokeMethodOnNull
  1&gt;   
  1&gt;  Write-Host : The term 'Write-Host' is not recognized as the name of a cmdlet, function, script file, or operable progra
  1&gt;  m. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
  1&gt;  At C:\Users\Konica Minolta\source\repos\ACV\ACV\install-application.ps1:56 char:1
  1&gt;  + Write-Host "Installing ACV..."
  1&gt;  + ~~~~~~~~~~
  1&gt;      + CategoryInfo          : ObjectNotFound: (Write-Host:String) [], CommandNotFoundException
  1&gt;      + FullyQualifiedErrorId : CommandNotFoundException
  1&gt;   
  1&gt;  You cannot call a method on a null-valued expression.
  1&gt;  At C:\Users\Konica Minolta\source\repos\ACV\ACV\install-application.ps1:59 char:1
  1&gt;  + $vault.CustomApplicationManagementOperations.InstallCustomApplication ...
  1&gt;  + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1&gt;      + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
  1&gt;      + FullyQualifiedErrorId : InvokeMethodOnNull
  1&gt;   
  1&gt;  Write-Host : The term 'Write-Host' is not recognized as the name of a cmdlet, function, script file, or operable progra
  1&gt;  m. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
  1&gt;  At C:\Users\Konica Minolta\source\repos\ACV\ACV\install-application.ps1:61 char:1
  1&gt;  + Write-Host "Restarting after install..."
  1&gt;  + ~~~~~~~~~~
  1&gt;      + CategoryInfo          : ObjectNotFound: (Write-Host:String) [], CommandNotFoundException
  1&gt;      + FullyQualifiedErrorId : CommandNotFoundException
  1&gt;   
  1&gt;  You cannot call a method on a null-valued expression.
  1&gt;  At C:\Users\Konica Minolta\source\repos\ACV\ACV\install-application.ps1:64 char:1
  1&gt;  + $server.VaultManagementOperations.TakeVaultOffline( $vaultOnServer.GU ...
  1&gt;  + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1&gt;      + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
  1&gt;      + FullyQualifiedErrorId : InvokeMethodOnNull
  1&gt;   
  1&gt;  You cannot call a method on a null-valued expression.
  1&gt;  At C:\Users\Konica Minolta\source\repos\ACV\ACV\install-application.ps1:65 char:1
  1&gt;  + $server.VaultManagementOperations.BringVaultOnline( $vaultOnServer.GU ...
  1&gt;  + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1&gt;      + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
  1&gt;      + FullyQualifiedErrorId : InvokeMethodOnNull
  1&gt;   
  ========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
  </code></pre>