Should this work?
>$PSVersionTable.PSVersion.ToString()
5.1.14409.1018
>(Get-CimInstance -ClassName CIM_OperatingSystem).Caption
Microsoft Windows 7 Enterprise
>Get-ComputerInfo
Get-ComputerInfo : Unable to find an entry point named 'GetFirmwareType' in DLL 'kernel32.dll'.
At line:1 char:1
+ Get-ComputerInfo
+ ~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-ComputerInfo], EntryPointNotFoundException
+ FullyQualifiedErrorId : System.EntryPointNotFoundException,Microsoft.PowerShell.Commands.GetComputerInfoCommand
Appears to be an issue with PowerShell 5.1 that wasn't corrected until PowerShell 6. I found this bug report on the PowerShell GitHub site. Bugs for PowerShell 6 are typically not backported to PowerShell 5.x.
There are several commands added in PS 5.1 that don't work at all on Windows 7. Resolve-DnsName, for example.
Related
I have this problem in a brand new workstation with Windows 10 installed: on powershell, the 5.1, when I call "Write-Host 'test'" I receive
Write-Host : The 'Write-Host' command was found in the module
'Microsoft.PowerShell.Utility', but the module could not
be loaded. For more information, run 'Import-Module Microsoft.PowerShell.Utility'.
At line:1 char:1
+ Write-Host "test"
+ ~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Write-Host:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CouldNotAutoloadMatchingModule
And if I try to Import-Module I receive an error.
I installed the powershell 7.2 and in that case I have no problem, but I must use the 5.1 for compatibility reasons.
I already tried to remove/reinstall the powershell windows feature but no way.
Does anyone have a suggestion?
Thx
We have a Powershell script which is using SkypeForBusiness module. This is being migrated to MicrosoftTeams and we found a problem with Get-CsOnlinePowerShellEndpoint:
PS C:\WINDOWS\system32> Get-CsOnlinePowerShellEndpoint -TargetDomain "xxxxx.onmicrosoft.com"
Get-CsOnlinePowerShellEndpoint : Parameter set cannot be resolved using the specified named parameters.
At line:1 char:1
+ Get-CsOnlinePowerShellEndpoint -TargetDomain "xxxxx.onmicrosoft. ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Get-CsOnlinePowerShellEndpoint], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : AmbiguousParameterSet,Microsoft.Teams.ConfigApi.Cmdlets.GetPowerShellEndpointCmdlet
The versions we are using are:
Windows Server 2019
PowerShell 5.1.18362.1474
MicrosoftTeams Module: 2.3.1 (version 2.0.0 fails too)
This same command is working fine on the old installation with Windows server 2016, PS 5.1 and SkypeOnlineConnector.
Any help will be much appreciated.
Thanks
A workaround for this to work is to add parameter OverrideDiscoveryUri with $null value. Example:
Get-CsOnlinePowerShellEndpoint -TargetDomain "xxxxx.onmicrosoft.com" -OverrideDiscoveryUri $null
The Stacktrace for the error was pointing to an AmbiguousParameterSet so it seems that there is a mix of parameters, even when the unique mandatory for this cmdlet is TargetDomain.
Which version of SharePointPnPPowerShellOnline does support below command? Mine is 3.20.2004.0 and trying to update Modern teamsite in sharepoint online environment.
Set-PnPSite -LogoFilePath c:\images\mylogo.png
Set-Variable : A parameter cannot be found that matches parameter name 'LogoFilePath'.
At line:1 char:13
+ set pnpsite -LogoFilePath C:\Project\Images\FPASiteLogo.png
+ ~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Set-Variable], ParameterBindingException
+ FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.Commands.SetVariableCommand
Tested the same version PnP PowerShell which is the latest version and LogoFilePath parameter is available, please see the PowerShell snippet:
But the site needs to be a Moder Site:
Reference:
Set-PnPSite
I'm playing around with IIS and Windows PowerShell, and based on this this Microsoft TechNet link I should be able to view all optional features for my OS with the PowerShell command:
PS C:\> Get-WindowsOptionalFeature –Online
When I try to use this command, I get this error message:
get-windowsoptionalfeature : An attempt was made to load a program with an incorrect format.
At line:1 char:1
+ get-windowsoptionalfeature -Online
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-WindowsOptionalFeature], COMException
+ FullyQualifiedErrorId : Microsoft.Dism.Commands.GetWindowsOptionalFeatureCommand
I've been reading around and most issues seem to be based on problems between 64-bit and 32-bit OS's, I've tried running it in both my standard PowerShell and PowerShell (x86), same error in both. Any ideas on why this is happening?
The Get-WindowsOptionalFeature cmdlet requires PowerShell 3.0.
This cmdlet must run with elevated rights. Right-click the Windows PowerShell 3.0 console while holding the CTRL key, and select Run As Administrator from the action menu (per: https://blogs.technet.microsoft.com/heyscriptingguy/2012/08/24/use-powershell-3-0-to-find-enabled-windows-8-features/).
The RSAT must be installed in order to use it. I don't think it has anything at all to do with 32-bit vs 64-bit.
When I run Add-PSSnapin microsoft.sharepoint.powershell I get
Add-PSSnapin : No snap-ins have been registered for Windows PowerShell version 3.
At line:1 char:1
+ Add-PSSnapin microsoft.sharepoint.powershell
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (microsoft.sharepoint.powershell:String) [Add-PSSnapin], PSArgumentException
+ FullyQualifiedErrorId : AddPSSnapInRead,Microsoft.PowerShell.Commands.AddPSSnapinCommand
I know this sounds dumb but I have searched Google for about 12 hours trying to just add this snapin. Im writting my first shell script and just need help getting off the start
What is your SharePoint version, 2010 or 2013?
What is your Powershell version? ($PSVersionTable.PSVersion)
SharePoint 2010 expects PowerShell version 2, which you can get to by running powershell -version 2
NB.
(To the commenter above)
If you dont have SharePoint installed on the PC you get this message.
Add-PSSnapin : The Windows PowerShell snap-in 'Microsoft.SharePoint.PowerShell' is not installed on this machine.
At line:1 char:13
+ Add-PSSnapin <<<< Microsoft.SharePoint.PowerShell
+ CategoryInfo : InvalidArgument: (Microsoft.SharePoint.PowerShell:String) [Add-PSSnapin], PSArgumentException
+ FullyQualifiedErrorId : AddPSSnapInRead,Microsoft.PowerShell.Commands.AddPSSnapinCommand
From your question I can understand you are using powershell version 3.0.
Please reboot your system and then try to add the snap-in.. It should work for you.