Giter Site home page Giter Site logo

powershellmodulecoverage's Introduction

logo PowerShell

Welcome to the PowerShell GitHub Community! PowerShell is a cross-platform (Windows, Linux, and macOS) automation and configuration tool/framework that works well with your existing tools and is optimized for dealing with structured data (e.g. JSON, CSV, XML, etc.), REST APIs, and object models. It includes a command-line shell, an associated scripting language, and a framework for processing cmdlets.

Windows PowerShell vs. PowerShell Core

Although this repository started as a fork of the Windows PowerShell codebase, changes made in this repository are not automatically ported back to Windows PowerShell 5.1. This also means that issues tracked here are only for PowerShell Core 6 and higher. Windows PowerShell specific issues should be reported with the Feedback Hub app, by choosing "Apps > PowerShell" in the category.

New to PowerShell?

If you are new to PowerShell and want to learn more, we recommend reviewing the getting started documentation.

Get PowerShell

You can download and install a PowerShell package for any of the following platforms.

Supported Platform Download (LTS) Downloads (stable) Downloads (preview) How to Install
Windows (x64) .msi .msi .msi Instructions
Windows (x86) .msi .msi .msi Instructions
Ubuntu 22.04 .deb .deb .deb Instructions
Ubuntu 20.04 .deb .deb .deb Instructions
Ubuntu 18.04 .deb .deb .deb Instructions
Ubuntu 16.04 .deb N/A N/A Instructions
Debian 10 .deb .deb .deb Instructions
Debian 11 .deb .deb .deb
CentOS 7 .rpm .rpm .rpm Instructions
CentOS 8 .rpm .rpm .rpm
Red Hat Enterprise Linux 7 .rpm .rpm .rpm Instructions
openSUSE 42.3 .rpm .rpm .rpm Instructions
Fedora 35 .rpm .rpm .rpm Instructions
macOS 10.13+ (x64) .pkg .pkg .pkg Instructions
macOS 11+ (arm64) .pkg .pkg .pkg Instructions
Docker Instructions

You can download and install a PowerShell package for any of the following platforms, which are supported by the community.

Platform Downloads (stable) Downloads (preview) How to Install
Arch Linux Instructions
Kali Linux .deb .deb Instructions
Many Linux distributions Snapcraft Snapcraft

You can also download the PowerShell binary archives for Windows, macOS, and Linux.

Platform Downloads (stable) Downloads (preview) How to Install
Windows 32-bit/64-bit 32-bit/64-bit Instructions
macOS (x64) 64-bit 64-bit Instructions
macOS (arm64) 64-bit 64-bit Instructions
Linux 64-bit 64-bit Instructions
Windows (ARM) 64-bit (preview) 64-bit Instructions
Raspbian (ARM) 32-bit/64-bit 32-bit/64-bit Instructions

To install a specific version, visit releases.

Upgrading PowerShell

For best results when upgrading, you should use the same install method you used when you first installed PowerShell. The update method will be different for each platform and install method. For more information, see Installing PowerShell.

Community Dashboard

Dashboard with visualizations for community contributions and project status using PowerShell, Azure, and PowerBI.

For more information on how and why we built this dashboard, check out this blog post.

Discussions

GitHub Discussions is a feature to enable free and open discussions within the community for topics that are not related to code, unlike issues.

This is an experiment we are trying in our repositories, to see if it helps move discussions out of issues so that issues remain actionable by the team or members of the community. There should be no expectation that PowerShell team members are regular participants in these discussions. Individual PowerShell team members may choose to participate in discussions, but the expectation is that community members help drive discussions so that team members can focus on issues.

Create or join a discussion.

Chat

Want to chat with other members of the PowerShell community?

There are dozens of topic-specific channels on our community-driven PowerShell Virtual User Group, which you can join on:

Add-ons and libraries

Awesome PowerShell has a great curated list of add-ons and resources.

Building the Repository

Linux Windows macOS
Instructions Instructions Instructions

If you have any problems building, consult the developer FAQ.

Build status of nightly builds

Azure CI (Windows) Azure CI (Linux) Azure CI (macOS) CodeFactor Grade
windows-nightly-image linux-nightly-image macOS-nightly-image cf-image

Downloading the Source Code

You can clone the repository:

git clone https://github.com/PowerShell/PowerShell.git

For more information, see working with the PowerShell repository.

Developing and Contributing

Please look into the Contribution Guide to know how to develop and contribute. If you are developing .NET Core C# applications targeting PowerShell Core, check out our FAQ to learn more about the PowerShell SDK NuGet package.

Also, make sure to check out our PowerShell-RFC repository for request-for-comments (RFC) documents to submit and give comments on proposed and future designs.

Support

For support, see the Support Section.

Legal and Licensing

PowerShell is licensed under the MIT license.

Windows Docker Files and Images

License: By requesting and using the Container OS Image for Windows containers, you acknowledge, understand, and consent to the Supplemental License Terms available on Docker Hub:

Telemetry

Please visit our about_Telemetry topic to read details about telemetry gathered by PowerShell.

Governance

The governance policy for the PowerShell project is described here.

This project has adopted the Microsoft Open Source Code of Conduct. For more information, see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

powershellmodulecoverage's People

Contributors

alexandair avatar joeyaiello avatar stevel-msft avatar tommymaynard avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

powershellmodulecoverage's Issues

Import-Module IISAdministration Fails With "Could not load file or assembly 'Microsoft.Web.Administration..."

Steps to reproduce

On Windows, run the following script in PowerShell 7.2.1:

Install-Module -Name IISAdministration
Import-Module IISAdministration
Get-Module -ListAvailable

Expected behavior

The import should succeed and the module should be listed:

Script     1.1.0.0               IISAdministration                   Core,Desk {Get-IISServerManager, Set-IISConfigAtt…

Actual behavior

The import fails with the following error:

Import-Module: Could not load file or assembly 'Microsoft.Web.Administration, Version=7.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.

The system cannot find the file specified.

The Get-Module list shows no cmdlets associated with IISAdministration:

Script     1.1.0.0               IISAdministration                   Core,Desk

Environment data

On the machine exhibiting the problem behavior:

PS C:\Users\thoma> $PSVersiontable

Name                           Value
----                           -----
PSVersion                      7.2.1
PSEdition                      Core
GitCommitId                    7.2.1
OS                             Microsoft Windows 10.0.19044
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

On the machine working successfully:

PS C:\Users\thomas.parikkaADM> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.2.1
PSEdition                      Core
GitCommitId                    7.2.1
OS                             Microsoft Windows 10.0.19042
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

I have confirmed on a VM running 19042 that the Windows 10 build is not a factor as far as I can tell, because on a 20H2 VM I still see the problem behavior. I have also enabled IIS Management Console and IIS Management Scripts and Tools. The bulk of the documentation I could find referred to earlier versions of PowerShell 7 not supporting IISAdministration, but this doesn't seem to apply to 7.2.1 - if it did globally, I wouldn't have myself and multiple other team members running the scripts with no issues. I appreciate any help!

Powershell 7 is unable to use Virtualmachinemanager module

Steps to reproduce

Get-SCVirtualMachine
Get-SCVirtualMachine: The type initializer for 'Microsoft.VirtualManager.Utils.TraceProviders.ImageLibrary' threw an exception.

Expected behavior

Output of SCVMM virtual machines.

Actual behavior

Get-SCVirtualMachine
Get-SCVirtualMachine: The type initializer for 'Microsoft.VirtualManager.Utils.TraceProviders.ImageLibrary' threw an exception.

Environment data

> $PSVersionTable
Name                           Value
----                           -----
PSVersion                      7.1.3
PSEdition                      Core
GitCommitId                    7.1.3
OS                             Microsoft Windows 10.0.17763
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Running this cmdlet in PS5.1 does work.

Get-ScheduledJob dost not work

From @magicedy on August 23, 2018 1:47

Steps to reproduce

>Import-Module PSScheduledJob -SkipEditionCheck
>Get-ScheduledJob

Expected behavior

It should work without issue. Furthermore, Import-Module ScheduledTasks -SkipEditionCheck; Get-ScheduledTask run successfully.

Actual behavior

Get-ScheduledJob : Could not load type 'System.Runtime.Serialization.NetDataContractSerializer' from assembly 'System.Runtime.Serialization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
At line:1 char:1
+ Get-ScheduledJob
+ ~~~~~~~~~~~~~~~~
+ CategoryInfo          : NotSpecified: (:) [Get-ScheduledJob], TypeLoadException
+ FullyQualifiedErrorId : System.TypeLoadException,Microsoft.PowerShell.ScheduledJob.GetScheduledJobCommand

Environment data

> $PSVersionTable
----                           -----
PSVersion                      6.1.0-rc.1
PSEdition                      Core
GitCommitId                    6.1.0-rc.1
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

Copied from original issue: PowerShell/PowerShell#7614

"remove-appxpackage -user" doesn't work

"Remove-AppxPackage -User" doesn't work (it never has). The user must be specified by SID. I'm glad that the -Users parameter was fixed in 1809.

Steps to reproduce

Remove-AppxPackage Microsoft.SkypeApp_14.53.85.0_x64__kzf8qxf38zg5c -User S-1-5-21-1234567890-1234567890-1234567890-4958
Get-AppxPackage -User S-1-5-21-1234567890-1234567890-1234567890-4958 *skype*

Expected behavior

# no output

Actual behavior

# program still installed

Name              : Microsoft.SkypeApp
Publisher         : CN=Skype Software Sarl, O=Microsoft Corporation, L=Luxembourg, S=Luxembourg, C=LU
Architecture      : X64
ResourceId        :
Version           : 14.53.85.0
PackageFullName   : Microsoft.SkypeApp_14.53.85.0_x64__kzf8qxf38zg5c
InstallLocation   : C:\Program Files\WindowsApps\Microsoft.SkypeApp_14.53.85.0_x64__kzf8qxf38zg5c
IsFramework       : False
PackageFamilyName : Microsoft.SkypeApp_kzf8qxf38zg5c
PublisherId       : kzf8qxf38zg5c
IsResourcePackage : False
IsBundle          : False
IsDevelopmentMode : False
NonRemovable      : False
IsPartiallyStaged : False
SignatureKind     : Store
Status            : Ok

Environment data

Windows 10 1903. Same problem in PS 7 preview 4.

Name                           Value
----                           -----
PSVersion                      6.2.3
PSEdition                      Core
GitCommitId                    6.2.3
OS                             Microsoft Windows 10.0.18362
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

AzAutomation Assets module not compatible with PSCore6

Steps to reproduce

Given the following AzAutomation PowerShell runbook using a Variable asset:

$var = Get-AutomationVariable -Name 'foo'
write-output "value: $var"  # should return 'bar'

Expected behavior

value: bar
Name Value
PSVersion 5.1.14393.2273
PSEdition Desktop

Actual behavior

value:
Name Value
PSVersion 6.1.0
PSEdition Core

Environment data

Name Value
PSVersion 6.1.0
PSEdition Core
GitCommitId 6.1.0
OS Linux 3.10.0-514.26.2.el7.x86_64 #1 SMP Tue J...
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0

-Properties parameter in ActiveDirectory module cmdlets doesn't accept value "*"

-Properties parameter in ActiveDirectory module cmdlets (Get-ADUser, Get-ADComputer, Get-ADObject, etc.) doesn't accept value "*" when invoked from PowerShell Core 6.1 on Windows 10 1809.
It works in Windows PowerShell 5.1.

Steps to reproduce

Windows PowerShell 5.1

[5.1] PS C:\> Get-ADUser someuser -Properties *
AccountExpirationDate                : somevalue
accountExpires                       : somevalue
AccountLockoutTime                   : somevalue
AccountNotDelegated                  : somevalue
adminCount                           : somevalue
AllowReversiblePasswordEncryption    : somevalue
...

PowerShell Core 6.1

[6.1.0] PS C:\> Get-ADUser someuser -Properties *
Get-ADUser : Object reference not set to an instance of an object.
At line:1 char:1
+ Get-ADUser someuser -Properties *
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : NotSpecified: (someuser:ADUser) [Get-ADUser], NullReferenceException
+ FullyQualifiedErrorId : ActiveDirectoryCmdlet:System.NullReferenceException,Microsoft.ActiveDirectory.Management.Commands.GetADUser

Expected behavior

Return all properties of the object, as it is in Windows PowerShell 5.1.

Actual behavior

Returns error message.

Environment data

> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      6.1.0
PSEdition                      Core
GitCommitId                    6.1.0
OS                             Microsoft Windows 10.0.17763
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Get-ADGroupMember fails to fetch the Group Members on Windows 1809 build

Steps to reproduce

Get-ADGroup -identity somegroup | Get-ADGroupMember
```

Expected behavior
-----------------

```

distinguishedName : CN=Test Name,OU=UserAccounts,DC=Test,DC=domain,DC=com
name              : Test Name
objectClass       : user
objectGUID        : Random GUID
SamAccountName    : test
SID               :  Random SID

```

Actual behavior
---------------

```
PSMessageDetails      :
Exception             : Microsoft.ActiveDirectory.Management.ADException: An operations error occurred ---> System.ServiceModel.FaultException`1[schemas.microsoft.com._2008._1.ActiveDirectory.CustomActions.GetADGroupMemberFault]: Active Directory returned an error
                        processing the operation.

                        Server stack trace:
                           at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
                           at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
                           at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
                           at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

                        Exception rethrown at [0]:
                           at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
                           at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
                           at schemas.microsoft.com._2008._1.ActiveDirectory.CustomActions.AccountManagement.GetADGroupMember(GetADGroupMemberRequest request)
                           at Microsoft.ActiveDirectory.Management.AdwsConnection.GetADGroupMember(GetADGroupMemberRequest request)
                           --- End of inner exception stack trace ---
                           at Microsoft.ActiveDirectory.Management.AdwsConnection.ThrowExceptionForErrorCode(String message, String errorCode, String extendedErrorMessage, Exception innerException)
                           at Microsoft.ActiveDirectory.Management.AdwsConnection.ThrowException(CustomActionFault caFault, FaultException faultException)
                           at Microsoft.ActiveDirectory.Management.AdwsConnection.GetADGroupMember(GetADGroupMemberRequest request)
                           at Microsoft.ActiveDirectory.Management.ADWebServiceStoreAccess.Microsoft.ActiveDirectory.Management.IADAccountManagement.GetADGroupMember(ADSessionHandle handle, GetADGroupMemberRequest request)
                           at Microsoft.ActiveDirectory.Management.ADAccountManagement.GetGroupMembers(String partitionDN, String groupDN, Boolean recursive)
                           at Microsoft.ActiveDirectory.Management.Commands.GetADGroupMember.GetADGroupMemberProcessCSRoutine()
                           at Microsoft.ActiveDirectory.Management.CmdletSubroutinePipeline.Invoke()
                           at Microsoft.ActiveDirectory.Management.Commands.ADCmdletBase`1.ProcessRecord()
TargetObject          : CN=PowerShell Discussions,OU=Distribution Lists,DC=redmond,DC=corp,DC=microsoft,DC=com
CategoryInfo          : NotSpecified: (CN=PowerShell D...icrosoft,DC=com:ADGroup) [Get-ADGroupMember], ADException
FullyQualifiedErrorId : ActiveDirectoryServer:8224,Microsoft.ActiveDirectory.Management.Commands.GetADGroupMember
ErrorDetails          :
InvocationInfo        : System.Management.Automation.InvocationInfo
ScriptStackTrace      : at <ScriptBlock>, <No file>: line 1
PipelineIterationInfo : {}

```

Environment data
----------------

<!-- provide the output of $PSVersionTable from PowerShell Core 6.1 -->

```powershell
> $PSVersionTable
Name                           Value
----                           -----
PSVersion                      5.1.17763.1
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.17763.1
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

```

Best Practices Module Does Not Load with PowerShell 7

The BestPractices module does not load in PowerShell 7. It also does not load using Windows Compatibility module.

Steps to reproduce

Import-Module -Name BestPractices
# or
Import-WinModule -Name BestPractices

Expected behaviour

I would have expected one or the other to have worked.

Actual behavior

Both fail.

Environment data

PS [C:\foo> ]> $PSVersionTable

Name Value


PSVersion 7.0.0-preview.3
PSEdition Core
GitCommitId 7.0.0-preview.3
OS Microsoft Windows 10.0.18980
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0, 5.0, 5.1.10032.0, 6.0.0, 6.1.0, 6.2.0, 7.0.0-preview.3}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0

Can't list all properties of Active Directory user

Steps to reproduce

PS C:\Users\cobalt> Get-ADUser -Identity $env:UserName -Properties *

Expected behavior

listing off user's properties

Actual behavior

Get-ADUser: Object reference not set to an instance of an object.

Environment data

> $PSVersionTable
Name                           Value
----                           -----
PSVersion                      7.2.4
PSEdition                      Core
GitCommitId                    7.2.4
OS                             Microsoft Windows 10.0.19044
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

This is apparently a known issue that was supposed to have been fixed, but has popped back up again, as per #8, #5, and #20.

IISAdministration: False error message translation into German

Prerequisites

  • Write a descriptive title.
  • Make sure you are able to repro it on the latest version
  • Search the existing issues.

Steps to reproduce

Using the New-IISSite CmdLet with a non-existing physical path for the -PhysicalPath parameter yields the following error message in German:

Der Parameter "PhysicalPath" sollte nicht auf einen vorhandenen Pfad zeigen.

... which translates to English as:

The "PhysicalPath" parameter should not point to an existing path.

The "not" is wrong in this error message. It should correctly read:

Der Parameter "PhysicalPath" muss auf einen vorhandenen Pfad zeigen.

... which would translate to English as:

The "PhysicalPath" parameter has to point to an existing path.

Expected behavior

See description.

Actual behavior

See description.

Error details

No response

Environment data

Name                           Value
----                           -----
PSVersion                      5.1.19041.1682
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.19041.1682
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Version

1.1.0.0

Visuals

No response

WebAdministration Module - IIS Provider does not load in PowerShell 7 (P.4)

Steps to reproduce

After installing IIS.

Import-Module WebAdministration

Expected behavior

It would load along with loading the provider

Actual behavior

PS C:\Foo> import-module webadministration
import-module : Module 'C:\Windows\system32\WindowsPowerShell\v1.0\Modules\webadministration\webadministration.psd1' does not support current PowerShell edition 'Core'. Its supported editions are 'Desktop'. Use 'Import-Module -SkipEditionCheck' to ignore the compatibility of this module.
At line:1 char:1
+ import-module webadministration
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : ResourceUnavailable: (C:\Windows\system32…administration.psd1:String) [Import-Module], InvalidOperationException
+ FullyQualifiedErrorId : Modules_PSEditionNotSupported,Microsoft.PowerShell.Commands.ImportModuleCommand
 

Environment data

PS C:\Foo> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.0.0-preview.4
PSEdition                      Core
GitCommitId                    7.0.0-preview.4
OS                             Microsoft Windows 10.0.17763
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0, 5.0, 5.1.10032.0, 6.0.0, 6.1.0, 6.2.0, 7.0.0-preview.4}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Import-PfxCertificate is not compatible with Temp:\ drive

(reported here as well: PowerShell/PowerShell#15516)

Steps to reproduce

[System.Convert]::FromBase64String($certificate) | Set-Content Temp:\cert.pfx -AsByteStream
Import-PfxCertificate -FilePath Temp:\cert.pfx -Password (ConvertTo-SecureString -String "$cert_pass" -AsPlainText -Force) -CertStoreLocation Cert:\CurrentUser\My

>>> Import-PfxCertificate: C:\Users\circleci\AppData\Local\Temp\remoteIpMoProxy_PKI_1.0.0.0_localhost_9ffcc35e-4d9c-45e6-9cac-a8a2924980b3\remoteIpMoProxy_PKI_1.0.0.0_localhost_9ffcc35e-4d9c-45e6-9cac-a8a2924980b3.psm1:1279
Line |
1279 |          $steppablePipeline.End()
     |          ~~~~~~~~~~~~~~~~~~~~~~~~
     | Cannot find drive. A drive with the name 'Temp' does not exist.

Expected behavior

Certificate is imported correctly.

Actual behavior

Unable to "find temp drive", despite content being written out to the specified file correctly.

Environment data

$PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.1.3
PSEdition                      Core
GitCommitId                    7.1.3
OS                             Microsoft Windows 10.0.17763
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0.}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Windows Update Module Does Not Work with PowerShell 7 (P.3)

Steps to reproduce

  1. Install Windows Server 2019.
  2. Install Software Update Windows Feature (using Wincompat module to load server manager).
  3. Try to load the windows update module from PWSH7 - it does not load. This is sort of as expected since the module is not based on .NET Core (yet).
  4. Try to load the module via Windows Compatibility module - it works, but all returned objects have no methods because the remoting returns de-serialized objects (ie no methods)/

In WSUS, methods are used, not cmdlet. So for example, some common operations might be as follows:

# 1. Get WSUS Server object
$WSUSServer = Get-WsusServer
# 2. Get WSUS Server Configuration
$WSUSServer.GetConfiguration()  # fails
# 3. Get WSUS Subscription(s)
$WSUSSubscription = $WSUSServer.GetSubscription()
# 4. Start-Synchronisation between this WSUS server and Windows Update
$WSUSSubscription.StartSynchronization()

Expected behaviour:

I would have expected steps 2, 3, and 4 to have worked. Instead (when used via WInCompat module), the $WSUSServer object has been deserialised thus it looses all the methods needed in steps 2, 3, and 4.

Actual behaviour

No methods returned so can't for use the key methods.
The bottom line is that WSUS can not be managed using PowerShell 7 (today).

Environment data

> $PSVersionTable
Name                           Value
----                           -----
PSVersion                      7.0.0-preview.3
PSEdition                      Core
GitCommitId                    7.0.0-preview.3
OS                             Microsoft Windows 10.0.17763
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0, 5.0, 5.1.10032.0, 6.0.0, 6.1.0, 6.2.0, 7.0.0-preview.3}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Get-WinUserLanguageList throws error "Cannot marshal 'parameter #2'"

Steps to reproduce

Get-WinUserLanguageList

Expected behavior

LanguageTag     : en-US
Autonym         : English (United States)
EnglishName     : English
LocalizedName   : English (United States)
ScriptName      : Latin
InputMethodTips : {0409:00000409}
Spellchecking   : True
Handwriting     : False

Actual behavior

Get-WinUserLanguageList: Cannot marshal 'parameter #2': Invalid managed/unmanaged type combination.

Environment data

> $PSVersionTable
Name                           Value
----                           -----
PSVersion                      7.1.0
PSEdition                      Core
GitCommitId                    7.1.0
OS                             Microsoft Windows 10.0.19042
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

get-aduser userid -Properties * - throws Object reference not set to instance of an object error

Steps to reproduce

get-aduser userid -Properties *

Expected behavior

Command should return user and all properties on the account

Actual behavior

get-aduser : Object reference not set to an instance of an object.
At line:1 char:1
+ get-aduser mcuroleadmin -Properties *
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : NotSpecified: (mcuroleadmin:ADUser) [Get-ADUser], NullReferenceException
+ FullyQualifiedErrorId : ActiveDirectoryCmdlet:System.NullReferenceException,Microsoft.ActiveDirectory.Management.Commands.GetADUser

Environment data

> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      6.1.0
PSEdition                      Core
GitCommitId                    6.1.0
OS                             Microsoft Windows 10.0.17751
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

System.Security.Cryptography.SHA256Cng fails to load

Steps to reproduce

(Note: exact same results with up-to-date pwsh-preview.)

09:52:41 evil@P950ER ~/Downloads» pwsh
PowerShell 6.2.2
Copyright (c) Microsoft Corporation. All rights reserved.

https://aka.ms/pscore6-docs
Type 'help' to get help.

PS /data/Downloads> install-module Microsoft.Graph.Intune
PS /data/Downloads> Import-Module Microsoft.Graph.Intune
PS /data/Downloads> Connect-MSGraph

Expected behavior

I expected to be prompted for credentials and connect to the graph API.

Actual behavior

Connect-MSGraph : Could not load type 'System.Security.Cryptography.SHA256Cng' from assembly 'System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
At line:1 char:1
+ Connect-MSGraph
+ ~~~~~~~~~~~~~~~
+ CategoryInfo          : NotSpecified: (:) [Connect-MSGraph], TypeLoadException
+ FullyQualifiedErrorId : System.TypeLoadException,Microsoft.Intune.PowerShellGraphSDK.PowerShellCmdlets.Connect

Environment data

----                           -----
PSVersion                      6.2.2
PSEdition                      Core
GitCommitId                    6.2.2
OS                             Linux 5.2.0-8-generic #9-Ubuntu SMP Mon Jul 8 13:07:27 UTC 2019
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

This was tested with core 6 as well as the current pwsh-preview github build from source (as of 8/6/2019) as well as current pwsh & pwsh-preview snaps on Ubuntu 18.04 and Ubuntu 19.10 (Eoan Ermine). See https://github.com/PowerShell/PowerShell/issues/10291.

Enable-WindowsOptionalFeature does not work with PowerShell 7.2.1

Steps to reproduce

Open a Windows Terminal as admin with PowerShell 7.2.1, then:

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All

Expected behavior

Hyper-V is enabled

Actual behavior

The command seems to start:

Enable-WindowsOptionalFeature: Microsoft-Hyper-V [Running                                                            ]

But then it freezes indefinitely.
The same command successfully runs in a few seconds with Windows Powershell (5.1.19041.1320).

Environment data

> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.2.1
PSEdition                      Core
GitCommitId                    7.2.1
OS                             Microsoft Windows 10.0.19044
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0, 5.0, 5.1.10032.0, 6.0.0, 6.1.0, 6.2.0, 7.0.0, 7.1.0, 7.2.1}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

AzureInformationProtection does not work

Steps to reproduce

Import-Module "C:\Program Files (x86)\Microsoft Azure Information Protection\Powershell\AzureInformationProtection"
Get-ChildItem | ForEach-Object { Get-AIPFileStatus $_.FullName }

Expected behavior

An object of the `Microsoft.InformationProtection.Powershell.AIP.Results.GetAIPFileStatusResult` is returned for each item.

Actual behavior

The following error is thrown for each item.

PSMessageDetails      :
Exception             : System.TypeInitializationException: The type initializer for 'NLog.LogManager' threw an exception.
                         ---> System.TypeInitializationException: The type initializer for 'NLog.LogFactory' threw an exception.
                         ---> System.MissingMethodException: Method not found: 'System.String System.AppDomainSetup.get_ConfigurationFile()'.
                           at NLog.Internal.Fakeables.AppDomainWrapper..ctor(AppDomain appDomain)
                           at NLog.Internal.Fakeables.AppDomainWrapper.get_CurrentDomain()
                           at NLog.LogFactory.get_CurrentAppDomain()
                           at NLog.LogFactory..cctor()
                           --- End of inner exception stack trace ---
                           at NLog.LogFactory..ctor()
                           at NLog.LogManager..cctor()
                           --- End of inner exception stack trace ---
                           at NLog.LogManager.GetLogger(String name)
                           at Microsoft.InformationProtection.Lib.NLogConfiguration.GetAssemblyLogger()
                           at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
                        --- End of stack trace from previous location where exception was thrown ---
                           at System.Lazy`1.CreateValue()
                           at Microsoft.InformationProtection.Powershell.AIP.Commandlets.AIPBaseCmdlet.HandleTerminatingException(Exception ex, ErrorCategory errorCategory, String message, Exception forwardException, Object target,
                        String errorId, Boolean isAnError)
                           at Microsoft.InformationProtection.Powershell.AIP.Commandlets.AIPBaseScannerCmdlet.BeginProcessing()
                           at System.Management.Automation.Cmdlet.DoBeginProcessing()
                           at System.Management.Automation.CommandProcessorBase.DoBegin()
TargetObject          :
CategoryInfo          : NotSpecified: (:) [Get-AIPFileStatus], TypeInitializationException
FullyQualifiedErrorId : System.TypeInitializationException,Microsoft.InformationProtection.Powershell.AIP.Commandlets.GetAIPFileStatusCmdLet
ErrorDetails          :
InvocationInfo        : System.Management.Automation.InvocationInfo
ScriptStackTrace      : at <ScriptBlock>, <No file>: line 1
PipelineIterationInfo : {}

Environment data

> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.0.0-preview.3
PSEdition                      Core
GitCommitId                    7.0.0-preview.3
OS                             Microsoft Windows 10.0.17763
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

AzureInformationProtection module version:
ModuleVersion = '2.2.19.0'

Add-AdfsWebApiApplication command not working in Powershell 7

Issue originally reported here. Was told to move it to this repository.

Steps to reproduce

  1. Windows System with ADFS Installed
  2. Have following AdfsAccessControlPolicy in place
Get-AdfsAccessControlPolicy -name "Permit specific claim"

Name           : Permit specific claim
Identifier     : Permitspecificclaim
IsBuiltIn      : False
RpUsageCount   : 4
LastUpdateTime : 25.03.2019 15:40:00
Description    :
PolicyMetadata : RequireFreshAuthentication:False
                 IssuanceAuthorizationRules:
                 {
                   Permit users
                     with <ClaimsParameter_0> in the request
                 }
                 ParameterDescription:
                 {
                   <ClaimsParameter_0>: Specify condition with ClaimType, Operator and Value using hashtable.
                 }
  1. Run script from following Gist Setup-AdfsApplicationGroup.ps1

Specifically this bit is the problem.

$acl = @{
    ClaimsParameter_0 = @{ ClaimType = 'http://schemas.microsoft.com/ws/2008/06/identity/claims/role'; Operator = 'Contains'; Value = $CustomerGroup }
}

Add-AdfsWebApiApplication -ApplicationGroupIdentifier $CustomerId -Identifier "$CustomerId" -Name "$CustomerId - Web Application" -AccessControlPolicyName "Permit specific claim" -AccessControlPolicyParameters $acl -TokenLifetime 15

Expected behavior

Should run and create an AdfsWebApplication

Actual behavior

Add-AdfsWebApiApplication: ADMIN0144: SpecificClaimCondition and SpecificClaimException parameter 'ClaimsParameter_0' should be assigned through a hashtable that specifies ClaimType, Operator and Value. If multiple conditions are desired, use an array of hashtables.

Additional information

I used dotPeak to look into Microsoft.IdentityServer.dll. The problem seems to be the following check inside the ParameterInterface.cs AssignSpecificClaimParemeterFromPSHInput method , which is not working in PowerShell 7 but is working in PowerShell 5.1

if (!(value is Hashtable hashtable))
  throw new InvalidDataException(Microsoft.IdentityServer.SR.GetString("ADMIN0144", (object) specific.Label));

The content of the variable value is the content that got passed into the AccessControlPolicyParameters parameter of the Add-AdfsWebApiApplication command.

It does not matter what you put into the AccessControlPolicyParameters parameter. It always triggers this check and throws the exception.

Environment data

PS C:\Temp> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.0.0
PSEdition                      Core
GitCommitId                    7.0.0
OS                             Microsoft Windows 10.0.17763
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

WebAdministration Module - Change "Home" Level Properties

Steps to reproduce

None, more of a feature request.

Expected behavior

To be able to change properties at "Home" (server) level in IIS

Actual behavior

This option is not available

Environment data

> $PSVersionTable
Name                           Value
----                           -----
PSVersion                      5.1.14393.4583
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.14393.4583
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Summary

I have asked about changing a specific property on stack overflow and this feature doesn't seem to be available (maybe it's not even possible).

I have one public IP address and, in IIS, 3 websites and 2 FTP sites. Not a problem, thanks to named bindings. However, IIS is a little broken when it comes to "correctly" choosing the path/certificate on said named bindings. I can't remember the link I used but you must specify the FTP SSL certificate at "Home" level AND at site level in order to establish a secure FTP connection.

I use Certify to manage my certificates and need to have a PowerShell command to transfer the certificate it creates to the other FTP site and to the top server level (or Home) in IIS.

Below is the PowerShell script I have and, as you can see, I have already tried setting it for the "Default Web Site".

Import-Module WebAdministration
$configItem = 'ftpServer.security.ssl.serverCertHash'
$thumb = Get-ItemProperty "IIS:\Sites\FTP 1" -Name ftpServer.security.ssl.serverCertHash.Value
Set-ItemProperty "IIS:\Sites\Default Web Site" -Name $configItem -Value $thumb
Set-ItemProperty "IIS:\Sites\FTP 2" -Name $configItem -Value $thumb

Side-bar: is there somewhere I can report the main problem (with IIS itself)

Though this is needed because of an issue with IIS; personally, I still think that setting top-level properties could still be required 😁

ActiveDirectory Module recognized but all Cmdlets fail with same error

Steps to reproduce

Get-ADDomain

Expected behavior

Return of user/domain information

Actual behavior

Error Message:

Get-ADUser: Type 'generatedProxy_14' from assembly 'ProxyBuilder, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' is attempting to implement an inaccessible interface.

Get-ADDomain domain.com
Get-ADDomain: Type 'generatedProxy_15' from assembly 'ProxyBuilder, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' is attempting to implement an inaccessible interface.

Environment data

Name                           Value
----                           -----
PSVersion                      7.0.0-preview.5
PSEdition                      Core
GitCommitId                    7.0.0-preview.5
OS                             Microsoft Windows 10.0.18362
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

typo - Get-ComputerInfo biosseralnumber - please fix typo

Steps to reproduce

>Get-ComputerInfo biosserialnumber

Expected behavior

BiosSerialNumber
---------------
xx9di43

Actual behavior


Environment data

> $PSVersionTable
PSVersion                      5.1.17763.1007
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.17763.1007
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.