PowerShell - 分布式解决方案

发布于 2024-07-13 13:21:39 字数 267 浏览 6 评论 0原文

我是 PS 新手,所以我可能会弄错一些术语。

如果您想为 30 名开发人员/DBA 组成的团队推出自定义 PowerShell 环境(管理单元)。 如果您打算每周推出一次新功能,那么最好的方法是什么? PowerShell 2.0 在这方面有帮助吗?

假设:
团队中的每个人安装 PowerShell(v1 或 v2)都没有问题

更新: 另请参阅下面 Jeffrey Snover 关于 v2 的回答。

I'm new to PS so I may get some of the terminology wrong.

If you want to roll out a custom PowerShell environment (snap-in) for a team of 30 developers/DBAs. What is the best way to do this... if you intend to be rolling out new functionality once a week? Does PowerShell 2.0 help in this regards?

Assumption:
There is no issue with everyone on the team installing PowerShell (v1 or v2)

Update:
Also see Jeffrey Snover's answer about v2 below.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

彻夜缠绵 2024-07-20 13:21:39

这在一定程度上取决于您打算进行的功能更改类型。 对于我们的环境,我们推出了一个非常标准的 PS 安装,然后向每个人的配置文件添加一行,以从服务器上的共享文件夹运行脚本。 然后在该脚本中我可以进行任何我想要应用于每个人的自定义。

我们将该行添加到机器特定的 MS 配置文件(%Windir% 中的那个),这是一个有意的选择。 我们这样做是为了让用户基本上只能在他们的生产盒子上获得这个。 这样,当他们编写内容时,他们可以快速登录到测试框并运行脚本,以确保脚本的部署不依赖于这些自定义。

目前的定制非常普通。 大部分只是一些添加的函数和别名。 我还有一个专门为 powershell 用 C# 编写的记录器,因此它从同一网络文件夹中的 dll 加载该记录器。

因为我经常玩弄我的环境,所以我的个人资料中有这个:)

$ProfileDir = ([System.IO.Directory]::GetParent($profile)).FullName
$localMSProfile = "$PShome\Microsoft.Powershell_profile.ps1"
$localAllProfile = "$PShome\profile.ps1"
$userAllProfile = "$ProfileDir\profile.ps1"
$userMSProfile = "$ProfileDir\Microsoft.Powershell_profile.ps1"
$allProfiles = ($localAllProfile, $localMSProfile, $userAllProfile, $userMSProfile)

It will depend to a certain extent on the sort of functionality changes that you intend to do. For our environment, we roll out a pretty standard PS install then add one line to everyone's profile to run a script from a shared folder on a server. Then in that script I can do whatever customization that I want to have applied to everyone.

We add the line to the machine specific MS profile (the one in %Windir%) this was an intentional choice. We do it that way so that the users essentially only get this on their production boxes. That way when they write something they can quickly log into a test box and run the script to make sure that the script will deploy without nay dependencies on these customizations.

Currently the customizations are pretty mundane. Mostly just some added functions and aliases. I also have a logger that I wrote in C# specifically for powershell so it loads that up from the dll that is in that same network folder.

Because I play around with my environment so much, I have this in my profile :)

$ProfileDir = ([System.IO.Directory]::GetParent($profile)).FullName
$localMSProfile = "$PShome\Microsoft.Powershell_profile.ps1"
$localAllProfile = "$PShome\profile.ps1"
$userAllProfile = "$ProfileDir\profile.ps1"
$userMSProfile = "$ProfileDir\Microsoft.Powershell_profile.ps1"
$allProfiles = ($localAllProfile, $localMSProfile, $userAllProfile, $userMSProfile)

这就是我们在 PowerShell V2 中添加 MODULE 支持的原因 - 这是 xcopy 部署函数集的最简单机制。 目前模块文档还很轻,但一两个月后应该会好得多。

实验! 享受! 从事!

杰弗里·斯诺尔 [MSFT]
Windows 管理合作伙伴架构师

This is why we added MODULE support in PowerShell V2 - it is the easiest mechanism to xcopy deploy sets of functions. The Module documentation is pretty light at this point but should be much better in a month or two.

Experiment! Enjoy! Engage!

Jeffrey Snover [MSFT]
Windows Management Partner Architect

一场春暖 2024-07-20 13:21:39

如果您每周推出新版本的管理单元,则切换版本可能对这部分事情没有帮助。 但是,您将在更新的平台上进行开发,并利用其附带的扩展功能。

正如已经建议的那样,某些脚本可以减轻部署的痛苦,您只需正确维护这些脚本并继续生成新的版本即可。

If you are rolling out a new version of the snap-in weekly, switching version probably won't help with that part of things. However, you'll be developing on a newer platform, with the advantage of the extended functionality that comes with it.

As already suggested some scripts could ease the deployment pain to the point where you have to do nothing but maintain those scripts correctly and keep producing new builds.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文