I have tested
1.Windows PowerShell speed is OK.
2.Windows PowerShell Core speed is OK.
3.The speed of Docker Container PowerShell Core is slow, and every operation after connecting to Exchange is slow as well. Each response takes more than 3 seconds to wait.
The source is an official image from mcr.microsoft.com/powershell, or it can be installed manually into the container. Below is the Dockerfile:
`
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
RUN apt-get update \
&& apt-get install -y wget gnupg apt-transport-https curl
RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
RUN sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-debian-bullseye-prod bullseye main" > /etc/apt/sources.list.d/microsoft.list'
RUN apt update && apt install -y powershell netbase
RUN sh -c "yes | pwsh -Command 'Install-Module -Name PSWSMan'"
RUN pwsh -Command 'Install-WSMan'
RUN cp /opt/microsoft/powershell/7/libpsrpclient.so /opt/microsoft/powershell/7/libmi.so /usr/lib
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src
COPY ["NuGet.config", "."]
COPY ["/IdentityManagerUI/IdentityManagerUI.csproj", "IdentityManagerUI/"]
COPY ["/CommonClassLibrary/CommonClassLibrary.csproj", "CommonClassLibrary/"]
COPY ["Management/Management.csproj", "Management/"]
RUN dotnet restore "Management/Management.csproj"
COPY . .
WORKDIR "/src/Management"
RUN dotnet build "Management.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "Management.csproj" -c Release -o /app/publish /p:UseAppHost=false
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Management.dll"]
`
Expected behavior
PS /> $sec_password = ConvertTo-SecureString "xxxxxx" -AsPlainText -Force;
PS /> $credential = New-Object System.Management.Automation.PSCredential("xxxx@xxxxxx.COM",$sec_password);
PS /> enter-pssession -Credential $credential -ConfigurationName Microsoft.Exchange -Authentication Kerberos -ConnectionUri http://xxxxxx.xxxx.com/PowerShell/
[xxxxxx.xxxx.com]: PS>Get-mailbox xxxx <=== It starts to slow down from here.
Name Alias ServerName ProhibitSendQuota
---- ----- ---------- -----------------
xxxx xxxx xxxx 190 MB (199,229,440 bytes)
[xxxxxx.xxxx.com]: PS>
Actual behavior
N/A
Error details
No response
Environment data
Name Value
---- -----
PSVersion 7.4.2
PSEdition Core
GitCommitId 7.4.2
OS Ubuntu 22.04.4 LTS
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Prerequisites
Steps to reproduce
I have tested 1.Windows PowerShell speed is OK. 2.Windows PowerShell Core speed is OK. 3.The speed of Docker Container PowerShell Core is slow, and every operation after connecting to Exchange is slow as well. Each response takes more than 3 seconds to wait. The source is an official image from mcr.microsoft.com/powershell, or it can be installed manually into the container. Below is the Dockerfile: ` FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base WORKDIR /app EXPOSE 80 EXPOSE 443 RUN apt-get update \ && apt-get install -y wget gnupg apt-transport-https curl RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - RUN sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-debian-bullseye-prod bullseye main" > /etc/apt/sources.list.d/microsoft.list' RUN apt update && apt install -y powershell netbase RUN sh -c "yes | pwsh -Command 'Install-Module -Name PSWSMan'" RUN pwsh -Command 'Install-WSMan' RUN cp /opt/microsoft/powershell/7/libpsrpclient.so /opt/microsoft/powershell/7/libmi.so /usr/lib FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build WORKDIR /src COPY ["NuGet.config", "."] COPY ["/IdentityManagerUI/IdentityManagerUI.csproj", "IdentityManagerUI/"] COPY ["/CommonClassLibrary/CommonClassLibrary.csproj", "CommonClassLibrary/"] COPY ["Management/Management.csproj", "Management/"] RUN dotnet restore "Management/Management.csproj" COPY . . WORKDIR "/src/Management" RUN dotnet build "Management.csproj" -c Release -o /app/build
FROM build AS publish RUN dotnet publish "Management.csproj" -c Release -o /app/publish /p:UseAppHost=false
FROM base AS final WORKDIR /app COPY --from=publish /app/publish . ENTRYPOINT ["dotnet", "Management.dll"] `
Expected behavior
Actual behavior
Error details
No response
Environment data
Visuals
No response