从 powershell 获取输入框提示中的输入请求
Getting the input request in a Input Box prompt from a powershell
我有一个电源shell转换成一个EXE以便于一些电源shell的工作。 EXE 以隐藏的方式定义,因此我无法对需要输入的脚本执行相同的操作。 shell 可能会抛出一个输入框,我可以在其中输入数据吗?
电源shell命令如前所述
$UserCredential = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
Import-PSSession $Session
Set-Mailbox
因此,如果我将其转换为 EXE 并 运行 以隐藏模式将其转换,我将没有机会添加邮箱名称。
我可以使用 Set-mailbox - indentity "Username" 但是因为有很多用户所以如果我 运行 这样就很容易
提前致谢!!
如果我理解您的问题,您希望让 PowerShell 脚本通过消息框提示用户进行一些输入,而不是在控制台中输入(因为控制台不可见)。对吗?
您可能 可以通过使用旧的 VB 提示框来完成此操作。像这样:
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.VisualBasic")
$mailbox = [Microsoft.VisualBasic.Interaction]::InputBox("Enter mailbox name", "Mailbox")
我有一个电源shell转换成一个EXE以便于一些电源shell的工作。 EXE 以隐藏的方式定义,因此我无法对需要输入的脚本执行相同的操作。 shell 可能会抛出一个输入框,我可以在其中输入数据吗?
电源shell命令如前所述
$UserCredential = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
Import-PSSession $Session
Set-Mailbox
因此,如果我将其转换为 EXE 并 运行 以隐藏模式将其转换,我将没有机会添加邮箱名称。
我可以使用 Set-mailbox - indentity "Username" 但是因为有很多用户所以如果我 运行 这样就很容易
提前致谢!!
如果我理解您的问题,您希望让 PowerShell 脚本通过消息框提示用户进行一些输入,而不是在控制台中输入(因为控制台不可见)。对吗?
您可能 可以通过使用旧的 VB 提示框来完成此操作。像这样:
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.VisualBasic")
$mailbox = [Microsoft.VisualBasic.Interaction]::InputBox("Enter mailbox name", "Mailbox")