那么Powershell PSC1 文件有什么特别之处呢?

编程入门 行业动态 更新时间:2024-10-25 02:24:27
本文介绍了那么Powershell PSC1 文件有什么特别之处呢?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

在我的 PowerShell 快捷方式上,我有以下内容:

On my PowerShell shortcut I have the following:

C:\WINDOWS\system32\WindowsPowerShell\v1.0\powershell.exe -psc "C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\vim.psc1" -noe -c ". \"C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\Scripts\Initialize-PowerCLIEnvironment.ps1\""

然而,我更愿意添加管理单元的注册并在我的配置文件中运行 PowerCLI 环境的初始化.

Yet, I would prefer to add the registration of snapins and to run the init of the PowerCLI environment to my profile.

所以在我的个人资料中添加以下内容:

So in my profile I add the following:

Add-PSSnapin VMware.VimAutomation.Core & "C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\Scripts\Initialize-PowerCLIEnvironment.ps1"

然而,使用此方法无法再使用 Get-VICommand.为什么?

Yet, the Get-VICommand is no longer available using this method. Why?

推荐答案

PSC1 文件是PowerShell 控制台文件".它们是 XML 配置文件,告诉 PowerShell 自动加载哪些管理单元.另一种方法是在 Profile.ps1 脚本中调用 Import-Module 或 Add-PSSnapin.

PSC1 files are "PowerShell Console files." They are XML configuration files that tell PowerShell which snapins to load automatically. The other way to do that would be to call Import-Module or Add-PSSnapin in your Profile.ps1 script.

您可以使用 Export-Console 创建自己的 psc1 文件.

You can create your own psc1 files using Export-Console.

更多推荐

那么Powershell PSC1 文件有什么特别之处呢?

本文发布于:2023-07-27 03:03:37,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1219965.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:有什么   之处   文件   Powershell

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!