0

I'm trying to use SIF 2.0 to uninstall a no longer used Sitecore 9.1 instance.

This method used to work perfectly with previous versions and I know that for sure since I'm quite a hard user.

I don't know exactly if that's something with SIF 2.0 or something with my given instance. It's a vanilla Sitecore 9.1 + SPE 5.0 + SXA 1.8.

[------------------------------------------------------------------------- SitecoreXP0_RemoveHostHeader : HostHeader ------------------------------------
[SitecoreXP0_RemoveHostHeader]:[Backup] Created - C:\Windows\system32\drivers\etc\hosts.backup
Removing host entry for 127.0.0.1 with hostname 'Sitecore91.SXA.sc'...
Uninstall-SitecoreConfiguration : Stream was not readable.
At C:\Sitecore\Install Packages\9.1\XP0\XP0-SingleDeveloper.ps1:77 char:1
+ Uninstall-SitecoreConfiguration @singleDeveloperParams *>&1 | Tee-Obj ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Install-SitecoreConfiguration

[TIME] 00:00:07
Set-Content : Stream was not readable.
At C:\Program Files\WindowsPowerShell\Modules\SitecoreInstallFramework\2.0.0\Public\Tasks\Invoke-HostHeaderTask.ps1:57 char:4
+             Set-Content -Path $hostsFile -Value $updatedHostsContent  ...
+             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (C:\Windows\system32\drivers\etc\hosts:String) [Set-Content], ArgumentException
    + FullyQualifiedErrorId : GetContentWriterArgumentError,Microsoft.PowerShell.Commands.SetContentCommand
3
  • 1
    Did your host file get wiped out? This has happened to me and the SIF-less creator (Rob) a few times. Feb 12 '19 at 18:25
  • Right on point @MichaelWest. Hopefully enough it looks like SIF made a host.backup file before pranking me, so I'm back on the game. But did you find the cause of this weird behavior? Feb 12 '19 at 18:41
  • I believe there is a bug in the SIF module. Rob told me about it on slack. Reach out to him if you need some more details. Feb 12 '19 at 18:43
3

This is a bug in SIF/ Set-content. This is now fixed in version 2.1, run Update-Module -Name SitecoreInstallFramework .

It's caused by another application, usually Chrome or VS code taking control of the hosts file while it's being written to.

For now, make sure that you don't have Chrome or similar running when you do the uninstall. Then it should be OK.

C:\Windows\system32\drivers\etc\hosts.backup is a backup of the file you can use that to restore the hosts file.

1
  • Thanks especially for the C:\Windows\system32\drivers\etc\hosts.backup note! Mar 11 '19 at 16:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.