如何在 Powershell v3.0 中查找新的 cmdlet
我想在 Powershell 中找到新的 cmdlet/函数。我使用了以下方法,但不确定它是否全面/正确。有什么想法可以以更好/不同的方式找到这个吗?
从 v2 运行一次下面的命令,从 v3 运行一次(并写入不同的文件)
get-command -Module Microsoft.PowerShell.* |
select -expand name | out-file e:\poshv2.txt
然后使用 Compare-Object 查看添加(或删除)的内容
Compare-Object (gc e:\poshv2.txt) (gc e:\poshv3.txt)
我基于此的观察是添加了 25 个新的 cmdlet(并且没有删除)
我的博客上的评论中提出的一个问题是,此列表中出现的 Disable-PsRemoting
并不是什么新鲜事。它出现的原因是它不在 Microsoft.Powershell.*
下的模块中(并且它不是 cmdlet),而是在 v3.0 中。
I wanted to find the new cmdlets / functions in Powershell. I used the following approach, but not sure if it is comprehensive / correct. Any ideas to find this in a better / different way?
Run the below once from v2 and once from v3 ( and write to a different file)
get-command -Module Microsoft.PowerShell.* |
select -expand name | out-file e:\poshv2.txt
Then use Compare-Object to see what's added ( or removed)
Compare-Object (gc e:\poshv2.txt) (gc e:\poshv3.txt)
My observation based on this is that there were 25 new cmdlets added ( and none were removed)
One question that was raised as a comment on my blog was that Disable-PsRemoting
, which appeared in this list, is not really new. The reason it appeared was that it was not in the modules under Microsoft.Powershell.*
( and it was not a cmdlet), but it is in v3.0.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您已经注意到的唯一区别是,在 v2 中,Disable-PsRemoting 是一个函数,而在 v3 中,它是一个 cmdlet。我在 PowerShell 杂志网站上撰写了有关 v3 中的 cmdlet 和参数更改的文章(使用类似的比较方法)。
http:// www.powershellmagazine.com/2011/09/15/how-to-find-out-whats-new-in-powershell-vnext/
The only difference which you already noted is that in v2 Disable-PsRemoting was a function and in v3 it's a cmdlet. I wrote about cmdlet and parameter changes in v3 (using a similar compare method) on the PowerShell Magazine website.
http://www.powershellmagazine.com/2011/09/15/how-to-find-out-whats-new-in-powershell-vnext/