PowerShell script execution failed. Script returned status 1 using account user
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2024 01:45 AM
PowerShell script execution failed. Script returned status 1 using account user
can anyone help me that how to resolve this issue?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2024 07:35 AM
Hello @snow34 ,
Did you find a solution for this error message please ? I'm having the same error also..
Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2024 12:15 AM
Hi @snow34
Are you passing any credentials in your script ? Also, from where you are running this script, from a workflow or a flow or via ecc queue ? Is your script intended to run on mid server ?
If possible, could you please share the script.
Thanks and Regards
Amit Verma
Please mark this response as correct and helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-05-2024 02:33 AM
I am running this from flow designer. below is the script for your reference.
Param([string]$collection, [string]$device)
# Import SCCM module
Import-Module "$executingScriptDirectory\SCCMSpoke\SCCMMain" -DisableNameChecking
# Copy the environment variables to their parameters
if (test-path env:\SNC_collection) {
$collection = $env:SNC_collection
$device = $env:SNC_device
}
SNCLog-ParameterInfo @("Running RemoveFromDeviceCollection", $collection, $device)
function Remove-FromDeviceCollection() {
Import-Module -Name "$(split-path $Env:SMS_ADMIN_UI_PATH)\ConfigurationManager.psd1"
Set-Location -path "$(Get-PSDrive -PSProvider CMSite):\"
$collection = $args[0];
$device = $args[1];
$id = (Get-CMDevice -Name $device).ResourceID
Remove-CMDeviceCollectionDirectMembershipRule -CollectionName $collection -ResourceId $id -force
}
try {
$session = Create-PSSession -sccmServerName $computer -credential $cred
SNCLog-DebugInfo "`tInvoking Invoke-Command -ScriptBlock `$'{function:Remove-FromDeviceCollection}' -ArgumentList $collection, $device"
if(($collection -eq $null) -or ($collection -eq "")) {
Write-Host "Empty collection name"
} elseif(($device -eq $null) -or ($device -eq "")) {
Write-Host "Empty device name"
} else {
Invoke-Command -Session $session -ScriptBlock ${function:Remove-FromDeviceCollection} -ArgumentList $collection, $device
}
} catch {
Write-Host $error
}finally {
if($session -ne $null) {
Remove-PSSession -session $session
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2025 05:35 AM
Hi All,
Was anyone able to fix this issue ?
I'm trying to configure MS exchange server spoke.
I'm getting the same error. If anyone had successfully configured exchange server integration using spoke, please let me know.
Thanks,
Siva
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-01-2025 02:42 AM