11$ErrorActionPreference = ' Stop'
22
3+ set-content - path " C:\AppData\migration-manager\first-boot.log" - value " Beginning post-migration first-boot service"
4+
35# Delete the service so it doesn't run again.
46reg delete " hklm\system\currentcontrolset\services\migrationmanagerfirstboot" / f
57
@@ -9,19 +11,28 @@ remove-item "C:\migration-manager-first-boot.ps1"
911# Run the Incus agent if present.
1012foreach ($drive in get-psdrive - psprovider filesystem) {
1113 if (test-path " $ ( $drive.Root ) \incus-agent" ) {
12- start-process powershell.exe - argumentlist " -file `" $ ( $drive.Root ) \install.ps1`" " - wait
14+ add-content - path " C:\AppData\migration-manager\first-boot.log" - value " Installing Incus Agent"
15+ # start-process powershell.exe -argumentlist "-file `"$($drive.Root)\install.ps1`"" -wait
16+
17+ $cmd = ' -command "& '' {0}\install.ps1'' *> '' C:\AppData\migration-manager\incus-agent.log'' "' -f " $ ( $drive.Root ) "
18+ start-process powershell.exe - argumentlist $cmd - wait
1319 break
1420 }
1521}
1622
1723# Bring disks that had a drive letter online.
1824if (test-path " C:\migration-manager-virtio-assign-diskcfg.ps1" ) {
19- start-process powershell.exe - argumentlist " -file `" C:\migration-manager-virtio-assign-diskcfg.ps1`" " - wait
25+ add-content - path " C:\AppData\migration-manager\first-boot.log" - value " Reassigning drive letters"
26+
27+ $cmd = ' -command "& '' C:\migration-manager-virtio-assign-diskcfg.ps1'' *> '' C:\AppData\migration-manager\disk-assign.log'' "'
28+ start-process powershell.exe - argumentlist $cmd - wait
2029}
2130
2231# Run network config reassignment if present.
2332if (test-path " C:\migration-manager-virtio-assign-netcfg.ps1" ) {
24- $cmd = ' -command "& '' C:\migration-manager-virtio-assign-netcfg.ps1'' *> '' C:\migration-manager-net.log'' "'
33+ add-content - path " C:\AppData\migration-manager\first-boot.log" - value " Reassigning network configs"
34+
35+ $cmd = ' -command "& '' C:\migration-manager-virtio-assign-netcfg.ps1'' *> '' C:\AppData\migration-manager\net-assign.log'' "'
2536 start-process powershell.exe - argumentlist $cmd - wait
2637}
2738
0 commit comments