While connecting to Mysql Getting below error with PowerShell - powershell

Exception calling "Open" with "0" argument(s): "Could not load file or assembly 'Renci.SshNet, Version=2016.1.0.0,
Culture=neutral, PublicKeyToken=1cee9f8bde3db106' or one of its dependencies. The system cannot find the file specified."

Related

Sometimes powershell fails to Import-Module Microsoft.PowerShell.LocalAccounts

I have a simple PowerShell script that is supposed to be run on the Windows Server 2019 64 bit machine. I use the Get-LocalGroupMemeber cmdlet in this script, which is part of the LocalAccounts module.
The problem is that my script fails to run because the module couldn't be loaded and the worst part is that the problem appears only a few times out of hundreds. Meaning, if I re-run the script right after its failure it will be finished successfully. Another strange thing is that it's not the only module that fails from time to time, the same happens with the SQLPS module.
I use the following batch file for my script invocation because in reality it is invoked from a 32-bit application, whereas the OS version is 64 bit.
if "%PROCESSOR_ARCHITEW6432%"=="AMD64" (
set pwshPass=%SystemRoot%\Sysnative\WindowsPowerShell\v1.0\powershell.exe
) else (
set pwshPass=%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe
)
%pwshPass% -ExecutionPolicy Bypass -File ".\Run.ps1"
Here is the stack trace of the error:
The 'Get-LocalGroupMember' command was found in the module 'Microsoft.PowerShell.LocalAccounts', but the module could not be loaded.
For more information, run 'Import-Module Microsoft.PowerShell.LocalAccounts'.
---$gt; System.Management.Automation.CmdletInvocationException: Could not load file or assembly 'file:///C:\windows\system32\WindowsPowerShell\v1.0\Modules\Microsoft.PowerShell.LocalAccounts\1.0.0.0\Microsoft.Powershell.LocalAccounts.dll' or one of its dependencies.
Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED)) ---$gt; System.IO.FileLoadException: Could not load file or assembly 'file:///C:\windows\system32\WindowsPowerShell\v1.0\Modules\Microsoft.PowerShell.LocalAccounts\1.0.0.0\Microsoft.Powershell.LocalAccounts.dll' or one of its dependencies.
Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED)) ---$gt; System.Runtime.InteropServices.COMException:
Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED))

RegAsm : error RA0000 failed to load dll because it is not a valid .NET Assembly

I am facing a problem with installshield 2012 while registering the DLL using Regasm from exec task in MSBuild script. Its giving the below error:
[Step 6/10] RegAsm : error RA0000 : Failed to load 'E:\BuildAgent\work\2ae7096f1a3f5702\dev\bin\Obfusc-Contributor\orgname.ShellExtension.FileManager.dll' because it is not a valid .NET assembly
[05:45:33] [Step 6/10] RegAsm.exe failed. E:\BuildAgent\work\2ae7096f1a3f5702\dev\bin\Obfusc-Contributor\orgname.ShellExtension.FileManager.reg was not created for Component Colligo.ShellExtension.FileManager.dll1
[05:45:33] [Step 6/10] ISDEV : error -6210: An error occurred building COM .NET Interop information for Component orgname.ShellExtension.FileManager.dll1
This is happening on windows 10 . The same task is working fine on Windows 2008 machine

TFS: Exception calling "SetRight" with "2" argument(s): "Could not obtain the user information."

I have a release definition in TFS with 2 tasks. One of them passes perfectly, while the other throws an exception, though both have very smimlar configuration.
The successful task configuration:
CopyFile Task
Source: $(System.DefaultWorkingDirectory)/XXX Build Definition/drop
Machines $(WebServers)
Admin Login: server\user
Password: Password
Protocol: HTTP
Destination Folder: C:\DestFolder
Variables: WebServers: MyServer
The failing task configuration:
RunPowerShellOnRemoteComputer Task
Machines $(WebServers)
Admin Login: server\user
Password: Password
Protocol: HTTP
PowerShell Script: C:\...\script.ps1
Variables: WebServers: MyServer
When running the second task I receive this exception:
Exception calling "SetRight" with "2" argument(s): "Could not obtain
the user information." CategoryInfo :NotSpecified: (:) [],
MethodInvocationException FullyQualifiedErrorId :Exception --->
System.Management.Automation.RemoteException: Exception calling
"SetRight" with "2" argument(s): "Could not obtain the user
information."
--- End of inner exception stack trace ---
at Microsoft.VisualStudio.Services.DevTestLabs.Deployment.Deployment.PowershellExecutor.Invoke(String
errorContextMessage, Boolean writeResultToLog, Boolean isCancellable)
at Microsoft.VisualStudio.Services.DevTestLabs.Deployment.Deployment.RemoteDeploymentHelper.InstallServiceInternal(String
serviceSourcePath, String serviceName, String destinationFileName)
at Microsoft.VisualStudio.Services.DevTestLabs.Deployment.Deployment.RemoteDeploymentHelper.InstallService(String
serviceSourcePath, String serviceName, String destinationFileName)
at Microsoft.VisualStudio.Services.DevTestLabs.Deployment.Deployment.DeploymentClient.d__24.MoveNext()
---> (Inner Exception #0) System.Management.Automation.RemoteException: Exception calling
"SetRight" with "2" argument(s): "Could not obtain the user
information."<---
Deployment status for machine 'bgsovswops.eu.hpecorp.net:5985' : 'Failed' ##[error], MethodInvocationException\r\n
FullyQualifiedErrorId :Exception\r\n"}};]
##[error]System.Management.Automation.RuntimeException: Failed to install
'VisualStudioRemoteDeployer3e199746-ae71-4ba0-a2ef-f5ce8f25a631' from
service executable path VisualStudioRemoteDeployer.exe . Consult the
logs below: Exception calling "SetRight" with "2" argument(s): "Could
not obtain the user information." CategoryInfo :NotSpecified: (:)
[], MethodInvocationException FullyQualifiedErrorId :Exception
---> System.Management.Automation.RuntimeException: Failed to install 'VisualStudioRemoteDeployer3e199746-ae71-4ba0-a2ef-f5ce8f25a631' from
service executable path VisualStudioRemoteDeployer.exe . Consult the
logs below: Exception calling "SetRight" with "2" argument(s): "Could
not obtain the user information." CategoryInfo :NotSpecified: (:)
[], MethodInvocationException FullyQualifiedErrorId :Exception
--- End of inner exception stack trace ---
at System.Management.Automation.Runspaces.PipelineBase.Invoke(IEnumerable
input)
at System.Management.Automation.PowerShell.Worker.ConstructPipelineAndDoWork(Runspace
rs, Boolean performSyncInvoke)
at System.Management.Automation.PowerShell.Worker.CreateRunspaceIfNeededAndDoWork(Runspace
rsToUse, Boolean isSync)
at System.Management.Automation.PowerShell.CoreInvokeHelper[TInput,TOutput](PSDataCollection1
input, PSDataCollection1 output, PSInvocationSettings settings)
at System.Management.Automation.PowerShell.CoreInvoke[TInput,TOutput](PSDataCollection1
input, PSDataCollection1 output, PSInvocationSettings settings)
at Microsoft.TeamFoundation.DistributedTask.Handlers.LegacyVSTSPowerShellHost.VSTSPowerShellHost.Main(String[]
args)
When I go to the remote machine, I succesfully execute the 'Invoke-Expression' on the C:...\script.ps1.
Also, I successfully connect from the local machines' powerscript console to the remote machine.
Any suggestions appreciated.
Please include the domain in the username variable. If it’s not domain environment, it should be the machine name.
So, just try to update the UPN user name format to DOMAIN\Username or MACHINENAME\Username format.
Check NetLogon Windows Service
The target server that I was deploying to reported this error. I already had the username for the PowerShell on Target Machines task set to use full DOMAIN\Username, per Andy's answer.
It turned out that the machine's NetLogon service had not started properly when the machine booted, due to it running on an abnormally busy VSphere cluster.
A reboot of the machine ensured that the NetLogon Windows Service, and its dependent services were all started, following which a redeploy succeeded.

Autonomylab create_autonomy launch error

I'm following instructions to create_autonomy, but I keep getting the following error:
[create_2.launch] is neither a launch file in package [ca_driver] nor is [ca_driver] a launch file name. The traceback for the exception was written to the log file
Does anyone know what I'm doing wrong?

WindowsAzure Assembly not found while downloading Hive output on HDInsight

The following script runs a hive job from my local machine running Windows 8.1 and copies the output to a local file. It has been working fine up to now, but after upgrading to Windows 10 it is erroring out when I call Get-AzureHDInsightJobOutput. I have tried uninstalling Windows Azure Powershell, and reinstalling, but that did not help. Not sure how to proceed now, anyone have any ideas?
# Retrieve a single tagged stream from project hive database into a single file
#
#
param(
[string]$table = 'sensor_part',
[string]$bld = 'B24',
[string]$tag = 'B24/AHU/LR/_1/OAT'
)
$clusterName = 'Crunch88'
$HiveQuery = "select * from ${table} where bld='${bld}' and tag='${tag}'"
$jobDefinition = New-AzureHDInsightHiveJobDefinition -Query $HiveQuery -StatusFolder '/tagtransfer'
$job = Start-AzureHDInsightJob -Cluster $clusterName -JobDefinition $jobDefinition
Write-Host "Wait for the Hive job to complete ..." -ForegroundColor Green
Wait-AzureHDInsightJob -Job $job -WaitTimeoutInSeconds 72000
Get-AzureHDInsightJobOutput -StandardError -JobId $job.JobId -Cluster $clusterName
Write-Host "Copy the standard output to a local file" -ForegroundColor Green
Get-AzureHDInsightJobOutput -Cluster $clusterName -JobId $job.JobId -DownloadTaskLogs -TaskLogsDirectory "tasklogs"
# AzCopy /Y /Source:${blobcontainer} /Dest:${tsvpath} /SourceKey:${blobkey} /Pattern:${dirout}/stdout
Here is the results of a run with the error message:
PS C:\Windows\System32\WindowsPowerShell\v1.0> F:\88acres\3-hive\hiveretrieval\error.ps1
WARNING: When submitting a query use the -RunAsFile switch to prevent errors with query lengths or special characters
Wait for the Hive job to complete ...
Cluster : Crunch88
ExitCode : 0
Name : Hive: select * from sensor
PercentComplete : map 100% reduce 0%
Query : select * from sensor_part where bld='B24' and tag='B24/AHU/LR/_1/OAT'
State : Completed
StatusDirectory : /tagtransfer
SubmissionTime : 30-Aug-15 12:26:18
JobId : job_1438448805059_0015
Get-AzureHDInsightJobOutput : Could not load file or assembly 'Microsoft.WindowsAzure.Storage, Version=3.0.3.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
At F:\88acres\3-hive\hiveretrieval\error.ps1:18 char:1
+ Get-AzureHDInsightJobOutput -StandardError -JobId $job.JobId -Cluster ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-AzureHDInsightJobOutput], FileNotFoundException
+ FullyQualifiedErrorId : System.IO.FileNotFoundException,Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.PSCmdlets.GetAzu
reHDInsightJobOutputCmdlet
Copy the standard output to a local file
Get-AzureHDInsightJobOutput : Could not load file or assembly 'Microsoft.WindowsAzure.Storage, Version=3.0.3.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
At F:\88acres\3-hive\hiveretrieval\error.ps1:21 char:1
+ Get-AzureHDInsightJobOutput -Cluster $clusterName -JobId $job.JobId - ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-AzureHDInsightJobOutput], FileNotFoundException
+ FullyQualifiedErrorId : System.IO.FileNotFoundException,Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.PSCmdlets.GetAzu
reHDInsightJobOutputCmdlet
Update:
I have enabled fusion logging. The results indicate that it is binding to 5.0.0.0 instead of 3.0.3.0. Not sure how to fix this.
Failed log entry for 3.0.3.0 follows:
*** Assembly Binder Log Entry (04-Sep-15 # 08:54:11) ***
The operation failed.
Bind result: hr = 0x80070002. The system cannot find the file specified.
Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll
Running under executable C:\Windows\System32\WindowsPowerShell\v1.0\powershell_ise.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: DisplayName = Microsoft.WindowsAzure.Storage, Version=3.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
(Fully-specified)
LOG: Appbase = file:///C:/Windows/System32/WindowsPowerShell/v1.0/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = powershell_ise.exe
Calling assembly : Microsoft.Hadoop.Client, Version=1.5.9.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35.
===
LOG: This bind starts in LoadFrom load context.
WRN: Native image will not be probed in LoadFrom context. Native image will only be probed in default load context, like with Assembly.Load().
LOG: Using application configuration file: C:\Windows\System32\WindowsPowerShell\v1.0\powershell_ise.exe.Config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Post-policy reference: Microsoft.WindowsAzure.Storage, Version=3.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
LOG: GAC Lookup was unsuccessful.
LOG: Attempting download of new URL file:///C:/Windows/System32/WindowsPowerShell/v1.0/Microsoft.WindowsAzure.Storage.DLL.
LOG: Attempting download of new URL file:///C:/Windows/System32/WindowsPowerShell/v1.0/Microsoft.WindowsAzure.Storage/Microsoft.WindowsAzure.Storage.DLL.
LOG: Attempting download of new URL file:///C:/Windows/System32/WindowsPowerShell/v1.0/Microsoft.WindowsAzure.Storage.EXE.
LOG: Attempting download of new URL file:///C:/Windows/System32/WindowsPowerShell/v1.0/Microsoft.WindowsAzure.Storage/Microsoft.WindowsAzure.Storage.EXE.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft SDKs/Azure/PowerShell/ServiceManagement/Azure/HDInsight/Microsoft.WindowsAzure.Storage.DLL.
LOG: Assembly download was successful. Attempting setup of file: C:\Program Files (x86)\Microsoft SDKs\Azure\PowerShell\ServiceManagement\Azure\HDInsight\Microsoft.WindowsAzure.Storage.dll
LOG: Entering run-from-source setup phase.
LOG: Assembly Name is: Microsoft.WindowsAzure.Storage, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
WRN: Comparing the assembly name resulted in the mismatch: Major Version
ERR: The assembly reference did not match the assembly definition found.
ERR: Run-from-source setup phase failed with hr = 0x80131040.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft SDKs/Azure/PowerShell/ServiceManagement/Azure/HDInsight/Microsoft.WindowsAzure.Storage/Microsoft.WindowsAzure.Storage.DLL.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft SDKs/Azure/PowerShell/ServiceManagement/Azure/HDInsight/Microsoft.WindowsAzure.Storage.EXE.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft SDKs/Azure/PowerShell/ServiceManagement/Azure/HDInsight/Microsoft.WindowsAzure.Storage/Microsoft.WindowsAzure.Storage.EXE.
LOG: All probing URLs attempted and failed.
***
Assembly Binder Log Entry (04-Sep-15 # 08:54:11) ***
And here is the successful version for 5.0.0.0:
*** Assembly Binder Log Entry (04-Sep-15 # 08:54:10) ***
The operation was successful.
Bind result: hr = 0x0. The operation completed successfully.
Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll
Running under executable C:\Windows\System32\WindowsPowerShell\v1.0\powershell_ise.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: DisplayName = Microsoft.WindowsAzure.Storage, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
(Fully-specified)
LOG: Appbase = file:///C:/Windows/System32/WindowsPowerShell/v1.0/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = powershell_ise.exe
Calling assembly : Microsoft.WindowsAzure.Commands.Sync, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35.
===
LOG: This bind starts in LoadFrom load context.
WRN: Native image will not be probed in LoadFrom context. Native image will only be probed in default load context, like with Assembly.Load().
LOG: Using application configuration file: C:\Windows\System32\WindowsPowerShell\v1.0\powershell_ise.exe.Config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Post-policy reference: Microsoft.WindowsAzure.Storage, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
LOG: GAC Lookup was unsuccessful.
LOG: Attempting download of new URL file:///C:/Windows/System32/WindowsPowerShell/v1.0/Microsoft.WindowsAzure.Storage.DLL.
LOG: Attempting download of new URL file:///C:/Windows/System32/WindowsPowerShell/v1.0/Microsoft.WindowsAzure.Storage/Microsoft.WindowsAzure.Storage.DLL.
LOG: Attempting download of new URL file:///C:/Windows/System32/WindowsPowerShell/v1.0/Microsoft.WindowsAzure.Storage.EXE.
LOG: Attempting download of new URL file:///C:/Windows/System32/WindowsPowerShell/v1.0/Microsoft.WindowsAzure.Storage/Microsoft.WindowsAzure.Storage.EXE.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft SDKs/Azure/PowerShell/ServiceManagement/Azure/Compute/Microsoft.WindowsAzure.Storage.DLL.
LOG: Assembly download was successful. Attempting setup of file: C:\Program Files (x86)\Microsoft SDKs\Azure\PowerShell\ServiceManagement\Azure\Compute\Microsoft.WindowsAzure.Storage.dll
LOG: Entering run-from-source setup phase.
LOG: Assembly Name is: Microsoft.WindowsAzure.Storage, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
LOG: Where-ref bind Codebase does not match what is found in default context. Keep the result in LoadFrom context.
LOG: Binding succeeds. Returns assembly from C:\Program Files (x86)\Microsoft SDKs\Azure\PowerShell\ServiceManagement\Azure\Compute\Microsoft.WindowsAzure.Storage.dll.
LOG: Assembly is loaded in LoadFrom load context.
Update: Added the required assembly using a Nuget package. Still didn't help. Think I somehow need to tell Nuget to make it available for the PowerShellISE, but don't see a parameter for that... This must be close to a solution.
PS C:\WINDOWS\system32> nuget install WindowsAzure.Storage -version 3.0.3
Attempting to resolve dependency 'Microsoft.Data.OData (ò 5.6.0)'.
Attempting to resolve dependency 'System.Spatial (= 5.6.0)'.
Attempting to resolve dependency 'Microsoft.Data.Edm (= 5.6.0)'.
Attempting to resolve dependency 'Newtonsoft.Json (ò 5.0.6)'.
Attempting to resolve dependency 'Microsoft.Data.Services.Client (ò 5.6.0)'.
Attempting to resolve dependency 'Microsoft.WindowsAzure.ConfigurationManager (ò 1.8.0.0)'.
Installing 'System.Spatial 5.6.0'.
Successfully installed 'System.Spatial 5.6.0'.
Installing 'Microsoft.Data.Edm 5.6.0'.
Successfully installed 'Microsoft.Data.Edm 5.6.0'.
Installing 'Microsoft.Data.OData 5.6.0'.
Successfully installed 'Microsoft.Data.OData 5.6.0'.
Installing 'Newtonsoft.Json 5.0.6'.
Successfully installed 'Newtonsoft.Json 5.0.6'.
Installing 'Microsoft.Data.Services.Client 5.6.0'.
Successfully installed 'Microsoft.Data.Services.Client 5.6.0'.
Installing 'Microsoft.WindowsAzure.ConfigurationManager 1.8.0.0'.
Successfully installed 'Microsoft.WindowsAzure.ConfigurationManager 1.8.0.0'.
Installing 'WindowsAzure.Storage 3.0.3.0'.
Successfully installed 'WindowsAzure.Storage 3.0.3.0'.
PS C:\WINDOWS\system32> F:\88acres\3-hive\hiveretrieval\error.ps1
WARNING: When submitting a query use the -RunAsFile switch to prevent errors with query lengths or special characters
Wait for the Hive job to complete ...
Cluster : Crunch88
ExitCode : 0
Name : Hive: select * from sensor
PercentComplete : map 100% reduce 0%
Query : select * from sensor_part where bld='B24' and tag='B24/AHU/LR/_1/OAT'
State : Completed
StatusDirectory : /tagtransfer
SubmissionTime : 04-Sep-15 08:03:50
JobId : job_1440975278889_0021
Get-AzureHDInsightJobOutput : Could not load file or assembly 'Microsoft.WindowsAzure.Storage, Version=3.0.3.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
At F:\88acres\3-hive\hiveretrieval\error.ps1:18 char:1
+ Get-AzureHDInsightJobOutput -StandardError -JobId $job.JobId -Cluster ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-AzureHDInsightJobOutput], FileNotFoundException
+ FullyQualifiedErrorId : System.IO.FileNotFoundException,Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.PSCmdlets.GetAzu
reHDInsightJobOutputCmdlet
I didn't find a good solution for this issue. I ran into this same issue after I installed to Visual Studio 2015, so if someone has a good solution I'd love to hear it. At this point in time... I just took the Microsoft.WindowsAzure.Storage.dll version 3.0.3.0 and copied it to my \Program Files (x86)\Microsoft SDKs\Azure\PowerShell\ServiceManagement\Azure\HDInsight folder (making a backup of the newer version first). It works fine now, but this is only a temporary work around.