
[英]Delete Directory (UnauthorizedAccessException)
我正在尝试删除由 Service Fabric 创建的目录,但它只是抛出一个异常。 当我对这个目录中的两个文件尝试 get-acl 时,它甚至不允许我这样做。 当我在目录上运行 get-acl 时: 当前用户也是“管理员”的成员,所以我不确定我是否理解为什么我在这里无法访问;)。 任何指针? 运行 ...
[英]Delete Directory (UnauthorizedAccessException)
我正在尝试删除由 Service Fabric 创建的目录,但它只是抛出一个异常。 当我对这个目录中的两个文件尝试 get-acl 时,它甚至不允许我这样做。 当我在目录上运行 get-acl 时: 当前用户也是“管理员”的成员,所以我不确定我是否理解为什么我在这里无法访问;)。 任何指针? 运行 ...
[英]Possible encoding issue with conda in PowerShell 7
我正在尝试为 PowerShell 设置 conda,但一直遇到奇怪的错误。 我正在使用 miniconda3(为所有用户安装)和 PS 版本 7.3.1。 conda 可执行文件被添加到$Env:PATH并且我能够运行conda init powershell ,它在我的 PowerShell ...
[英]Powershell how to check if friday is the last day of the month , returning True from a Function
我试图在 Powershell 中制作一个 function,如果该月的最后一天是星期五,它会产生一个 True。 但是如何检查那个星期五是否是该月的最后一天呢? ...
[英]Move list of users from one OU to a different OU and disable them at the same time - Powershell
我目前有一个脚本可以使用指定了用户名列表的文本文件来禁用用户名列表: 我想知道在执行此脚本期间是否可以合并使用从一个 OU 到另一个 OU 的移动? 例如,从“用户”OU 移动到“禁用用户”OU。 我创建了另一个脚本,它确实将用户名列表移动到“禁用用户”OU: 非常感谢对此的任何帮助。 ...
[英]How to send commands to Powershell from Python as an administrator?
如何以管理员身份发送 slmgr /ipk W269N-WFGWX-YVC9B-4J6C9-T83GX 到 Powershell ...
[英]Remove-MgApplicationKey - delete expired app registration certificates
我正在从 AzureAD 模块更新我当前的脚本,并想更新一个删除过期应用程序注册证书的脚本。 我可以使用新模块删除过期的机密,但是新命令 Remove-MgApplicationKey 需要根据 Microsoft 文档提供证明: https://learn.microsoft.com/en-us/ ...
[英]How to run a powershell script passing a parameter to another script in a remote server?
我正在尝试读取如下所示的 json 文件 然后为每个商店运行一个 for 循环并将随附的 LocationUUID 作为参数传递给另一个 PowerShell 脚本,并在商店 1 和 2 中运行该脚本。 要在商店 1 和 2 中运行的测试脚本如下所示: 每当我运行它时,我都会收到错误 A para ...
[英]How to get the folder sizes of top folders in shared drive and sort them from bigger to smaller
我正在使用 get-childitem 命令获取共享驱动器中的文件夹。 但是当我使用属性长度时,它返回空白。 如何使用 powershell 按大小对文件夹大小进行排序命令 iam 使用 Get-childitem -path $path -directory -depth 0 我试过 get ch ...
[英]Why do I get privileges errors even though I run windows Powershell as administrator?
我想通过 chocolatey 在我的机器上安装 miktex.install package。 我执行了这个命令 choco 安装 miktex.install --admin 但错误发生如下。 错误:正在运行的命令已停止,因为首选项变量“ErrorActionPreference”或公共参数设 ...
[英]How to import an array of PSObjects from a text file?
这很简单: 但是如何从格式化文本文件中获取 CSV 格式化数据呢? 这样每条记录的数据都被转置,然后写入 CSV 文件中的一行。 毫无疑问,这种逆运算有一个术语。 它本身不一定是 CSV,只是上面的示例源自 CSV。 请更正任何术语错误。 就目前而言,没有 $records object 本身不能 ...
[英]Problems with interconnected parameters in PowerShell Param block
我在思考使我的 Param 块在 PowerShell 5.1 中按我想要的方式运行所需的代码逻辑时遇到了麻烦。 带有 Param 块的非常简化的(但可用于我的请求)脚本在这里,这完全符合我的要求: 上面运行此脚本时参数的自动完成按预期工作。 如果我使用“-All”开关,则 -P# 不可用。 如果我 ...
[英]regex can't be first element for pipeline - how get match
我有一个在 windows 10 命令行运行的正则表达式,并得到错误: 我不确定如何将它与第一个元素中的匹配部分放在一起。 这是文档内容(显示了重要部分......有多个制造商和 S/N,但我只需要特定的): e:\temp\details.txt: 我成功地从这个powershell的文档中获取 ...
[英]Remove xml comments based on xml tags inside the comments with Powershell
我想根据带有 Powershell 的评论中的 xml 标签删除 xml 文件中的评论。 约束: 应该支持多行注释保留 xml 格式(例如,不要将所有内容都写成一行或删除缩进) 保留文件编码我的 function UncommentXmlNode应该删除<.--... -->并保留< ...
[英]What is the correct IP address conversion from number?
我正在尝试使用 powershell 方法将数字转换为 IP 地址并在线检查相同的地址,我得到 2 个不同的结果。 例子: 我试过下面的代码 我得到 2 个不同的结果,不确定哪一个是正确的,或者我应该更新 function。 ...
[英]How to import a CSV, which is not a CSV file, file into SQL database using PowerShell
我有一个看起来像这样的 txt 文件 我正在尝试使用 PowerShell 上传到我的 SQL 服务器数据库,但我不确定该怎么做,因此非常感谢任何建议或帮助。 我试图转换为 csv 文件,但所有内容都合并在 1 个单列中,所以我不能这样做。 ...
[英]Windows - Powershell - Configure "Local Group Policy Editor > ... > Account Lockout Policy > Account lockout threshold > invalid logon attempts"
我正在尝试找出一个PowerShell 命令来在 Windows 上设置“ Anti-Brute-Force-login-attempts ”。 这是以下手动步骤: gpedit.msc (打开“本地组策略编辑器”) 本地计算机策略 > 计算机配置 > Windows 设置 > ...
[英]Supported way to send office 365 smtp email which allow us to attach a file
我有这个代码发送 email 附件:- 但基于文档的警告,即Send-MailMessage已过时 @ https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/send-mailmessage? ...
[英]Is there a way to return to the command prompt temporarily
One 如何允许用户“暂停当前管道并返回到命令提示符”,然后在 powershell 脚本中恢复? 我在 Powershell 中关于用户交互的博客文章中偶然发现了这一行 它是提示中的模拟选项,模仿本机命令 (Remove-Item) 的外观。 瞧瞧:该命令实际上实现了该行为。 快速谷歌搜索,我没 ...
[英]Strange behavior of some zip files while extracting (7zip)
我在解压缩文件时遇到问题。 通常我使用 PowerShell 脚本,我运行 SQL 服务器数据库(过程),它会按照我想要的方式解压缩我的文件(数据库应该没有任何问题)。 脚本主要部分: 但偶尔会有一个 .zip 文件,如果通过此脚本运行,将提取文件名编码错误的文件,为了防止我需要手动打开每个 .z ...
[英]Is there a parameter for the authentification mechanism for MongoDb Connection when using Powershell?
我想使用 Powershell Skript 对数据库进行 Mongodump 备份,这是我从这个页面获得的: 文本我收到与错误的身份验证机制(SCRAM-SHA-1 而不是 SCRAM-SHA-256)相关的错误,但我找不到设置身份验证机制的参数。 我从上面改编的 Powershell Skri ...