I am using Ubuntu 20 and I have installed powershell to manage Office 365 accounts.
The powershell version is as follows:
Name Value
PSVersion 7.3.1
PSEdition Core
GitCommitId 7.3.1
OS Linux 5.15.0-58-generic #64~20.04.1-Ubuntu SMP Fri Jan 6 16:42:31 UTC 2023
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
When I run the command line with the correct credentials:
Connect-MsolService -Credential $Credentials
I get this error message:
Connect-MsolService: Could not load file or assembly 'System.IdentityModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. The system cannot find the file specified.
Connect-MsolService: Could not load file or assembly 'System.IdentityModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. The system cannot find the file specified.
Does any one know why?
Any help would be greatly appreciated...
Related
I get the error "/bin/sh: 1: powershell: not found" in the OUTPUT tab in Visual Studio Code Version 1.53.0 when i try to run simple script in a new file which is open in the editor.
does the "which pwsh" output "/opt/microsoft/powershell/7/pwsh" have anything to do with this? Maybe the path.
And as a result the PROBLEMS tab outputs:
some extra details:
PS /home/arend/.vscode/extensions/ms-vscode.powershell-2020.6.0/examples> which pwsh
/opt/microsoft/powershell/7/pwsh
PS /home/arend/.vscode/extensions/ms-vscode.powershell-2020.6.0/examples> $PSVersionTable
Name Value
PSVersion 7.1.1
PSEdition Core
GitCommitId 7.1.1
OS Linux 5.4.0-65-generic #73~18.04.1-Ubuntu SMP Tue Jan 19 09:02:24 UTC 2021
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Visual Studio Code
Version: 1.53.0
Commit: 8490d3dde47c57ba65ec40dd192d014fd2113496
Date: 2021-02-03T15:56:04.185Z
Electron: 11.2.1
Chrome: 87.0.4280.141
Node.js: 12.18.3
V8: 8.7.220.31-electron.0
OS: Linux x64 5.4.0-65-generic
I am getting the below error when importing the "AzureAD" powershell module. I have installed the module, unable to import it. I have checked to see if there are any prerequisites required, nothing mentioned in GitHub.
Earlier, I was able to install and import "AZ" module.
UPDATE : Resolved one dependency by copying the system.windows.forms.dll, but more runtime errors...
Name Value
---- -----
PSVersion 6.2.3
PSEdition Core
GitCommitId 6.2.3
OS Microsoft Windows 10.0.17134
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
VERBOSE: Loading module from path 'C:\Program
Files\PowerShell\Modules\AzureAd\2.0.2.76\AzureAd.psd1'. VERBOSE:
Loading 'FormatsToProcess' from path 'C:\Program
Files\PowerShell\Modules\AzureAd\2.0.2.76\AzureAD.Format.ps1xml'.
VERBOSE: Populating RepositorySourceLocation property for module
AzureAd. VERBOSE: Loading module from path 'C:\Program
Files\PowerShell\Modules\AzureAd\2.0.2.76\Microsoft.Open.Azure.AD.CommonLibrary.dll'.
Import-Module : Could not load file or assembly 'System.Windows.Forms,
Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
The system cannot find the file specified. At line:1 char:1
+ Import-Module -Name AzureAd -Scope Global -Verbose
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Import-Module], FileNotFoundException
+ FullyQualifiedErrorId : System.IO.FileNotFoundException,Microsoft.PowerShell.Commands.ImportModuleCommand
Which .NET version are you using? You may need to update it as this was an issue with older versions. If that doesn't work you can remove the dependency on System.Runtime.InteropServices.RuntimeInformation to get rid of the error in your screenshot.
It seems that the AzureAD Module is not compatible with PowerShell Core due to the WinForms dependency. I have tried both 7.0.0 and 6.2.4 which did not work
However you can install it using the Desktop version of PowerShell. This version works for me.
PS C:\Windows\system32> $PSVersionTable
Name Value
---- -----
PSVersion 5.1.18362.752
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.18362.752
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
Run elevated
Install-Module AzureAD
And then move on...
Import-Module -Name AzureAD
$creds = Get-Credential -Message "Credentials to connect to Azure AD"
Connect-AzureAD -Credential $creds
Get-AzureADCurrentSessionInfo
I have a problem with powershell.
I am trying to download a gif from the intranet of our company with a BAT data, but it always say the following error:
powershell -Command "(New-Object System.Net.WebClient).DownloadFile('https://domain.name/file.name','C:\file.name')"
can anyone help me?
edit: Here is the version of powershell:
sure here is the table:
Name Value
---- -----
PSVersion 5.0.10586.117
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.10586.117
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
The windows version is Windows 2008 R2
Best regards,
Xplosio
I am attempting to execute a PowerShell script that works fine on a windows 10 PC that has visual studio and all its dependencies installed, but it will not execute on a VM with a fresh installation of windows 10 pro. I've chiseled the script down and determined that the thing it does not like is the definition of a class in the script.
Class Computer {
[String]$Name
[String]$Description
[String]$Type
[String]$Owner
}
The error I get when running the script with nothing but this class definition is:
An error occurred while creating the pipeline.
+CategoryInfo: NotSpecified: (:) [], ParentContainsErrorRecordException
+FullyQualifiedErrorId: RuntimeException
Running $PSVersionTable on the fresh VM:
Name Value
---- -----
PSVersion 5.0.10240.16384
WSManStackVersion 3.0
SerializationVersion 1.1.0.1
CLRVersion 4.0.30319.42000
BuildVersion 10.0.10240.16384
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion 2.3
Doesn't PowerShell 5.0 have support for classes? Am I missing a .NET framework dependency that isn't installed or enabled by default with a fresh Windows 10 installation?
To get the WMF 5.0 functionaly, please update to the November Update (10.0.10586.0) per The WMF 5.0 release blog.
Note: If you are running Windows 10, you can get the same set of functionality available in WMF 5.0 RTM by updating to the November update of Windows 10 (Version 1511). If you have not already updated your Windows 10 system, select the Start button, then select Settings > Update & security > Windows Update > Check for updates.
I have PowerShell 3.0 installed, and I wish to emulate v1.0
When I launch PowerShell 3.0 with -Version 1 $PSVersionTable reports:
Name Value
---- -----
CLRVersion 2.0.50727.5456
BuildVersion 6.1.7601.17514
PSVersion 2.0
WSManStackVersion 2.0
PSCompatibleVersions {1.0, 2.0}
SerializationVersion 1.1.0.1
PSRemotingProtocolVersion 2.1
If I use the -Version 2 parameter I get the same result
If I use the -Version 3 parameter I get version 3.
Question, why can't I emulate version 1?
Looking at this answer, I don't think you can run 1 & 2 side-by-side without some surgery on the GAC (so it would follow that 1, 2 & 3 don't all co-exist either - only 2 & 3, because 2 & 3 were designed to run side by side). Version 2 was meant to completely replace version 1, AFAICT.
You can not run V1 using the side by side stuff. That was never supported. You CAN run V2 from V3, but not V1.