import-module in $profile

$PROFILE

C:\Users\clu\Documents\PowerShell\Microsoft.PowerShell_profile.ps1

 


Import-Module 'C:\Users\clu\source\repos\GitHub\Other\posh-git\src\posh-git.psd1'
Import-Module 'C:\Users\clu\source\repos\GitHub\Other\PowerShell\build.psm1'
#Import-Module "C:\Users\clu\source\repos\GitHub\Other\PowerShell\src\Modules\Windows\Microsoft.PowerShell.Management\Microsoft.PowerShell.Management.psd1"
Import-Module 'C:\Users\clu\source\repos\GitHub\ChuckLu\Scripts\Powershell\chuck.psm1'
#Import-Module "C:\Users\clu\source\repos\GitHub\Other\PowerShellGet\PowerShellGet"
#Import-Module "C:\Users\clu\source\repos\GitHub\Other\PowerShellGet\PowerShellGet\private\functions\Get-PSGalleryApiAvailability.ps1"
Import-WinModule Microsoft.PowerShell.Management

 

前置命令,需要安装

https://github.com/PowerShell/WindowsCompatibility  来确保可以使用Remove-EventLog

Install-Module WindowsCompatibility -Scope CurrentUser

然后才可以Import-WinModule Microsoft.PowerShell.Management

 

https://github.com/PowerShell/WindowsCompatibility/issues/73#issuecomment-655565655

In PowerShell 7, you should no longer need the WindowsCompatibility module. Instead try Import-Module -UseWindowsPowerShell <module>

 

 

 

PS C:\Users\clu\source\repos\NLogTest\NLogTest\bin\Debug> Import-WinModule Microsoft.PowerShell.Management
New-PSSession: C:\Users\clu\Documents\PowerShell\Modules\WindowsCompatibility\1.0.0\WindowsCompatibility.psm1:232
Line |
 232 |          $session = New-PSSession @newPSSessionParameters | Select-Obj …
     |                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | [localhost] Connecting to remote server localhost failed with the following error message : The client
     | cannot connect to the destination specified in the request. Verify that the service on the destination
     | is running and is accepting requests. Consult the logs and documentation for the WS-Management service
     | running on the destination, most commonly IIS or WinRM. If the destination is the WinRM service, run
     | the following command on the destination to analyze and configure the WinRM service: "winrm
     | quickconfig". For more information, see the about_Remote_Troubleshooting Help topic.

作者:Chuck Lu    GitHub    
posted @   ChuckLu  阅读(438)  评论(0编辑  收藏  举报
编辑推荐:
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
历史上的今天:
2017-09-26 IIS访问站点,出现connection refused
2016-09-26 Entity Framework 与多线程
2015-09-26 使用git批量删除分支
点击右上角即可分享
微信分享提示