Test-EntraScript
检查提供的脚本是否使用与 Microsoft Entra PowerShell 模块兼容的 Azure AD 命令。
语法
Default (默认值)
Test-EntraScript
-Path <String[]>
[-Content <String>]
[-Quiet]
[<CommonParameters>]
说明
检查提供的脚本是否使用与 Microsoft Entra PowerShell 模块兼容的 Azure AD 命令。
示例
示例 1
Test-EntraScript -Path .\usercreation.ps1 -Quiet
返回脚本usercreation.ps1是否可以在Microsoft下运行。Entra。
示例 2
Get-ChildItem -Path \\contoso.com\it\code -Recurse -Filter *.ps1 | Test-EntraScript
返回不会在Microsoft下运行的所有脚本的列表。Entra 模块,列出每一个问题的行和代码。
参数
-Content
要扫描的代码内容。 扫描没有文件表示形式的代码(例如,直接从存储库)时使用。
参数属性
| 类型: | System.String |
| 默认值: | None |
| 支持通配符: | False |
| 不显示: | False |
参数集
(All)
| Position: | 2 |
| 必需: | False |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | True |
| 来自剩余参数的值: | False |
-Path
要扫描的一个或多个脚本文件的路径。 指定 -Content 时的内容的名称
参数属性
| 类型: | String[] |
| 默认值: | None |
| 支持通配符: | False |
| 不显示: | False |
| 别名: | FullName, 名称 |
参数集
(All)
| Position: | 1 |
| 必需: | True |
| 来自管道的值: | True |
| 来自管道的值(按属性名称): | True |
| 来自剩余参数的值: | False |
-Quiet
仅返回 $true 或 $ false,具体取决于脚本是否可以在Microsoft下运行。Entra ($true) 或否 ($ false)
参数属性
| 类型: | System.Management.Automation.SwitchParameter |
| 默认值: | False |
| 支持通配符: | False |
| 不显示: | False |
参数集
(All)
| Position: | Named |
| 必需: | False |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
CommonParameters
此 cmdlet 支持通用参数:-Debug、-ErrorAction、-ErrorVariable、-InformationAction、-InformationVariable、-OutBuffer、-OutVariable、-PipelineVariable、-ProgressAction、-Verbose、-WarningAction 和 -WarningVariable。 有关详细信息,请参阅 about_CommonParameters。