Are you trying to get user input within a workflow? If so, why? Workflows are designed to run without user interaction.
I think you may be able to "InlineScript" a Read-Host, though. I've never tried it.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I have found that I am getting Access denied errors whilst running a Ps script that uses PowerShell workflows. The error details are as follows. What I also found is that if PowerShell workflows are not used, the script works fine.
Receive-Job : Win32 internal error "Access is denied" 0x5 occurred while reading the console output buffer. Contact
Microsoft Customer Support Services.
Are you trying to get user input within a workflow? If so, why? Workflows are designed to run without user interaction.
I think you may be able to "InlineScript" a Read-Host, though. I've never tried it.
Please see the code snippet below.
Workflow getAD-Details {
$objForest = [System.DirectoryServices.ActiveDirectory.Forest]::GetCurrentForest()
$DCServer = $objForest.NamingRoleOwner.Name
$DCServer += ':3268'
$search_list = @('Account1','Account2','Account3','Account4')
foreach -parallel -throttlelimit 4 ($account in $search_list) {
InLineScript {
$SearchResults = @()
$AccountNotFound = @()
$account_name = $using:account
$ErrorActionPreference = 'Continue'
try {
$SearchResults += Get-ADUser -ErrorAction Stop -identity $account_name -properties * -Server $using:DCServer |
Select-Object SamAccountName, @{n="Domain"; e={$_.userPrincipalName.Split('@.')[1]}}, Created,createTimeStamp
}
Catch {
Write-Error "The account $account_name does not exist"
$AccountNotFound += [PSCustomObject]@{
SearchDate = Get-Date
Account = $account_name
}
}
}
}
}
getAD-Details
Error details.
Receive-Job : Win32 internal error "Access is denied" 0x5 occurred while reading the console output buffer. Contact Microsoft Customer Support Services.