Search

$ErrorActionPreference=stop breaks Restore-WebConfiguration by Blindrood

Active

2
0
Sign in
to vote
Type: Bug
ID: 770587
Opened: 11/9/2012 3:36:26 AM
Access Restriction: Public
1
Workaround(s)
0
User(s) can reproduce this bug
When You set ErrorActionPreference to stop, You can't execute Restore-WebConfiguration.
This is because Restore-Webconfiguration uses Get-Service to find IISAdmin service. Normally it will return null or this service object. But if Action preference is set to stop it will throw error that is not handled.
Error doesn't appear if IISAdmin exists (if IIS6 Management compatibility is installed)
Details (expand)
How often does this happen?
Always Happens

Have you seen this problem before in this product?

Yes, this happens in all previous versions
Reproduction Steps
$ErrorActionPreference = 'stop'
Restore-Webconfiguration MyBackup
Expected Results
Restore should work (if MyBackup exists of course)
File Attachments
0 attachments
Sign in to post a comment.
Sign in to post a workaround.
Posted by Blindrood on 11/9/2012 at 3:39 AM
1. Temporarily change erroractionpreference to 'continue' or 'silentlycontinue'