Not running provided custom scripts
MercifulCamel opened this issue · comments
I'm trying to create a W10 Pro golden image.
It doesn't seem like my WindowsCloudImage is running my custom scripts that I have provided.
I added a powershell script that will install provided nvidia drivers and named it RunBeforeWindowsUpdates.ps1, it doesn't seem like it runs at all.
I have tested it and am sure that it will run and install drivers if run manually but would prefer that it was done during windows image creation phase.
Looked through logs in C:\Windows\Panther folder but it didn't shed any light on the problem.
Let me know if there's anymore information I can provide you with
Hey there!
Is your script really named RunAfterWindowsUpdate.ps1
? If so, the name isn't correct, it should be RunAfterWindowsUpdates.ps1 (you're missing the s at the end of Update
), at least from the example config, that you can find here :
The script has the s at the end, it was only a typo on my part when writing the issue.
$tempFolder = "C:\UnattendedResources\CustomResources"
$install_args = "-s -passive -noreboot -noeula"
Start-Process -FilePath "$tempFolder\win_nvidia.exe" -ArgumentList $install_args -Wait
Is the script which doesn't seem to be running, made sure the resources are in the right spot and even paused the imaging process to test run it.
Could it be because the Execution Policy is not set? But then it shouldn't be able to run other scripts right?
Hello @MercifulCamel,
Your issue looks like a misconfiguration, any logs from the imaging creation run would be helpful.
Can you please share the imaging tools logs from the PowerShell console that run New-WindowsOnlineImage?
Also, the RunAfter|RunBefore Hooks need to be in this folder: UnattendResources\CustomScripts\
Thank you,
Adrian.
Hi @ader1990
Sorry for the late replay.
I had to translate some things because they were written out in my native language instead of English so it might not be correctly worded.
2022-12-21 09:42:15 - ERROR: System.IO.IOException: The process cant access file C:\UnattendResources because it's being used by another process.
vid System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
vid System.IO.Directory.DeleteHelper(String fullPath, String userPath, Boolean recursive, Boolean throwOnTopLevelDirectoryNotFound, WIN32_FIND_DATA& data)
vid System.IO.Directory.Delete(String fullPath, String userPath, Boolean recursive, Boolean checkHost)
vid Microsoft.PowerShell.Commands.FileSystemProvider.RemoveFileSystemItem(FileSystemInfo fileSystemInfo, Boolean force)
New-WindowsCloudImage
2022-12-22 09:38:46 - Cloud image generation started.
WARNING: The installed version of DISM is older than the Windows image
2022-12-22 09:38:49 - Found already existing image file. Removing it...
2022-12-22 09:38:50 - Already existent image file has been removed.
2022-12-22 09:38:50 - Creating Virtual Disk Image: C:\Users\test\Desktop\win-golden.vhdx...
2022-12-22 09:38:55 - Successfuly created disk: C:\Users\test\Desktop\win-golden.vhdx
2022-12-22 09:38:55 - Generate Unattend Xml :G:\Unattend.xml...
2022-12-22 09:38:55 - Xml was generated.
2022-12-22 09:38:55 - Copy Unattend Resources: Client...
2022-12-22 09:38:55 - Copying: C:\Users\test\Desktop\windows-openstack-imaging-tools\UnattendResources G:\UnattendResources
2022-12-22 09:38:55 - Resources have been copied.
2022-12-22 09:38:55 - Copy Custom Resources: C:\Temp\client-config...
2022-12-22 09:38:55 - Copying: C:\Temp\client-config G:\UnattendResources
2022-12-22 09:38:59 - Copying: C:\Temp\scripts\ G:\UnattendResources
2022-12-22 09:38:59 - Custom Resources at: G:\UnattendResources.
2022-12-22 09:38:59 - Downloading Cloudbase-Init...
2022-12-22 09:39:01 - Applying Windows image "C:\Temp\install.wim" in "G:\"
Deployment Image Servicing and Management tool
Version: 10.0.19041.844
Applying image
[==========================100.0%==========================]
The operation completed successfully.
2022-12-22 09:44:37 - Create BCDBoot Config for Windows 10 Pro for Workstations
2022-12-22 09:44:39 - Resetting BCD boot border
Åtgärden har slutförts.
Åtgärden har slutförts.
Åtgärden har slutförts.
2022-12-22 09:44:39 - BCDBoot config has been created.
2022-12-22 09:44:39 - Adding drivers from "C:\Temp\drivers\" to image "G:\"
Deployment Image Servicing and Management tool
Version: 10.0.19041.844
Image Version: 10.0.19044.1288
Searching for driver packages to install...
Found 91 driver package(s) to install.
Installing 1 of 91 - C:\Temp\drivers\amd64\2k12\vioscsi.inf: The driver package was successfully installed.
Installing 2 of 91 - C:\Temp\drivers\amd64\2k12\viostor.inf: The driver package was successfully installed.
Installing 3 of 91 - C:\Temp\drivers\amd64\2k12R2\vioscsi.inf: The driver package was successfully installed.
Installing 4 of 91 - C:\Temp\drivers\amd64\2k12R2\viostor.inf: The driver package was successfully installed.
Installing 5 of 91 - C:\Temp\drivers\amd64\2k16\vioscsi.inf: The driver package was successfully installed.
Installing 6 of 91 - C:\Temp\drivers\amd64\2k16\viostor.inf: The driver package was successfully installed.
Installing 7 of 91 - C:\Temp\drivers\amd64\2k19\vioscsi.inf: The driver package was successfully installed.
Installing 8 of 91 - C:\Temp\drivers\amd64\2k19\viostor.inf: The driver package was successfully installed.
Installing 9 of 91 - C:\Temp\drivers\amd64\2k22\vioscsi.inf: The driver package was successfully installed.
Installing 10 of 91 - C:\Temp\drivers\amd64\2k22\viostor.inf: The driver package was successfully installed.
Installing 11 of 91 - C:\Temp\drivers\amd64\2k8R2\vioscsi.inf: The driver package was successfully installed.
Installing 12 of 91 - C:\Temp\drivers\amd64\2k8R2\viostor.inf: The driver package was successfully installed.
Installing 13 of 91 - C:\Temp\drivers\amd64\w10\vioscsi.inf: The driver package was successfully installed.
Installing 14 of 91 - C:\Temp\drivers\amd64\w10\viostor.inf: The driver package was successfully installed.
Installing 15 of 91 - C:\Temp\drivers\amd64\w11\vioscsi.inf: The driver package was successfully installed.
Installing 16 of 91 - C:\Temp\drivers\amd64\w11\viostor.inf: The driver package was successfully installed.
Installing 17 of 91 - C:\Temp\drivers\amd64\w7\vioscsi.inf: The driver package was successfully installed.
Installing 18 of 91 - C:\Temp\drivers\amd64\w7\viostor.inf: The driver package was successfully installed.
Installing 19 of 91 - C:\Temp\drivers\amd64\w8.1\vioscsi.inf: The driver package was successfully installed.
Installing 20 of 91 - C:\Temp\drivers\amd64\w8.1\viostor.inf: The driver package was successfully installed.
Installing 21 of 91 - C:\Temp\drivers\amd64\w8\vioscsi.inf: The driver package was successfully installed.
Installing 22 of 91 - C:\Temp\drivers\amd64\w8\viostor.inf: The driver package was successfully installed.
Installing 23 of 91 - C:\Temp\drivers\Balloon\2k12\amd64\balloon.inf: The driver package was successfully installed.
Installing 24 of 91 - C:\Temp\drivers\Balloon\2k12R2\amd64\balloon.inf: The driver package was successfully installed.
Installing 25 of 91 - C:\Temp\drivers\Balloon\2k16\amd64\balloon.inf: The driver package was successfully installed.
Installing 26 of 91 - C:\Temp\drivers\Balloon\2k19\amd64\balloon.inf: The driver package was successfully installed.
Installing 27 of 91 - C:\Temp\drivers\Balloon\2k22\amd64\balloon.inf: The driver package was successfully installed.
Installing 28 of 91 - C:\Temp\drivers\Balloon\2k3\amd64\balloon.inf: The driver package was successfully installed.
Installing 29 of 91 - C:\Temp\drivers\Balloon\2k3\x86\balloon.inf: The driver package was successfully installed.
Installing 30 of 91 - C:\Temp\drivers\Balloon\2k8\amd64\balloon.inf: The driver package was successfully installed.
Installing 31 of 91 - C:\Temp\drivers\Balloon\2k8\x86\balloon.inf: The driver package was successfully installed.
Installing 32 of 91 - C:\Temp\drivers\Balloon\2k8R2\amd64\balloon.inf: The driver package was successfully installed.
Installing 33 of 91 - C:\Temp\drivers\Balloon\w10\amd64\balloon.inf: The driver package was successfully installed.
Installing 34 of 91 - C:\Temp\drivers\Balloon\w10\ARM64\balloon.inf: The driver package was successfully installed.
Installing 35 of 91 - C:\Temp\drivers\Balloon\w10\x86\balloon.inf: The driver package was successfully installed.
Installing 36 of 91 - C:\Temp\drivers\Balloon\w11\amd64\balloon.inf: The driver package was successfully installed.
Installing 37 of 91 - C:\Temp\drivers\Balloon\w11\ARM64\balloon.inf: The driver package was successfully installed.
Installing 38 of 91 - C:\Temp\drivers\Balloon\w7\amd64\balloon.inf: The driver package was successfully installed.
Installing 39 of 91 - C:\Temp\drivers\Balloon\w7\x86\balloon.inf: The driver package was successfully installed.
Installing 40 of 91 - C:\Temp\drivers\Balloon\w8.1\amd64\balloon.inf: The driver package was successfully installed.
Installing 41 of 91 - C:\Temp\drivers\Balloon\w8.1\x86\balloon.inf: The driver package was successfully installed.
Installing 42 of 91 - C:\Temp\drivers\Balloon\w8\amd64\balloon.inf: The driver package was successfully installed.
Installing 43 of 91 - C:\Temp\drivers\Balloon\w8\x86\balloon.inf: The driver package was successfully installed.
Installing 44 of 91 - C:\Temp\drivers\Balloon\xp\amd64\balloon.inf: The driver package was successfully installed.
Installing 45 of 91 - C:\Temp\drivers\Balloon\xp\x86\balloon.inf: The driver package was successfully installed.
Installing 46 of 91 - C:\Temp\drivers\NetKVM\2k12\amd64\netkvm.inf: The driver package was successfully installed.
Installing 47 of 91 - C:\Temp\drivers\NetKVM\2k12R2\amd64\netkvm.inf: The driver package was successfully installed.
Installing 48 of 91 - C:\Temp\drivers\NetKVM\2k16\amd64\netkvm.inf: The driver package was successfully installed.
Installing 49 of 91 - C:\Temp\drivers\NetKVM\2k19\amd64\netkvm.inf: The driver package was successfully installed.
Installing 50 of 91 - C:\Temp\drivers\NetKVM\2k22\amd64\netkvm.inf: The driver package was successfully installed.
Installing 51 of 91 - C:\Temp\drivers\NetKVM\2k3\amd64\netkvm.inf: The driver package was successfully installed.
Installing 52 of 91 - C:\Temp\drivers\NetKVM\2k3\x86\netkvm.inf: The driver package was successfully installed.
Installing 53 of 91 - C:\Temp\drivers\NetKVM\2k8\amd64\netkvm.inf: The driver package was successfully installed.
Installing 54 of 91 - C:\Temp\drivers\NetKVM\2k8\x86\netkvm.inf: The driver package was successfully installed.
Installing 55 of 91 - C:\Temp\drivers\NetKVM\2k8R2\amd64\netkvm.inf: The driver package was successfully installed.
Installing 56 of 91 - C:\Temp\drivers\NetKVM\w10\amd64\netkvm.inf: The driver package was successfully installed.
Installing 57 of 91 - C:\Temp\drivers\NetKVM\w10\ARM64\netkvm.inf: The driver package was successfully installed.
Installing 58 of 91 - C:\Temp\drivers\NetKVM\w10\x86\netkvm.inf: The driver package was successfully installed.
Installing 59 of 91 - C:\Temp\drivers\NetKVM\w11\amd64\netkvm.inf: The driver package was successfully installed.
Installing 60 of 91 - C:\Temp\drivers\NetKVM\w11\ARM64\netkvm.inf: The driver package was successfully installed.
Installing 61 of 91 - C:\Temp\drivers\NetKVM\w7\amd64\netkvm.inf: The driver package was successfully installed.
Installing 62 of 91 - C:\Temp\drivers\NetKVM\w7\x86\netkvm.inf: The driver package was successfully installed.
Installing 63 of 91 - C:\Temp\drivers\NetKVM\w8.1\amd64\netkvm.inf: The driver package was successfully installed.
Installing 64 of 91 - C:\Temp\drivers\NetKVM\w8.1\x86\netkvm.inf: The driver package was successfully installed.
Installing 65 of 91 - C:\Temp\drivers\NetKVM\w8\amd64\netkvm.inf: The driver package was successfully installed.
Installing 66 of 91 - C:\Temp\drivers\NetKVM\w8\x86\netkvm.inf: The driver package was successfully installed.
Installing 67 of 91 - C:\Temp\drivers\NetKVM\xp\amd64\netkvm.inf: The driver package was successfully installed.
Installing 68 of 91 - C:\Temp\drivers\NetKVM\xp\x86\netkvm.inf: The driver package was successfully installed.
Installing 69 of 91 - C:\Temp\drivers\viostor\2k12\amd64\viostor.inf: The driver package was successfully installed.
Installing 70 of 91 - C:\Temp\drivers\viostor\2k12R2\amd64\viostor.inf: The driver package was successfully installed.
Installing 71 of 91 - C:\Temp\drivers\viostor\2k16\amd64\viostor.inf: The driver package was successfully installed.
Installing 72 of 91 - C:\Temp\drivers\viostor\2k19\amd64\viostor.inf: The driver package was successfully installed.
Installing 73 of 91 - C:\Temp\drivers\viostor\2k22\amd64\viostor.inf: The driver package was successfully installed.
Installing 74 of 91 - C:\Temp\drivers\viostor\2k3\amd64\viostor.inf: The driver package was successfully installed.
Installing 75 of 91 - C:\Temp\drivers\viostor\2k3\x86\viostor.inf: The driver package was successfully installed.
Installing 76 of 91 - C:\Temp\drivers\viostor\2k8\amd64\viostor.inf: The driver package was successfully installed.
Installing 77 of 91 - C:\Temp\drivers\viostor\2k8\x86\viostor.inf: The driver package was successfully installed.
Installing 78 of 91 - C:\Temp\drivers\viostor\2k8R2\amd64\viostor.inf: The driver package was successfully installed.
Installing 79 of 91 - C:\Temp\drivers\viostor\w10\amd64\viostor.inf: The driver package was successfully installed.
Installing 80 of 91 - C:\Temp\drivers\viostor\w10\ARM64\viostor.inf: The driver package was successfully installed.
Installing 81 of 91 - C:\Temp\drivers\viostor\w10\x86\viostor.inf: The driver package was successfully installed.
Installing 82 of 91 - C:\Temp\drivers\viostor\w11\amd64\viostor.inf: The driver package was successfully installed.
Installing 83 of 91 - C:\Temp\drivers\viostor\w11\ARM64\viostor.inf: The driver package was successfully installed.
Installing 84 of 91 - C:\Temp\drivers\viostor\w7\amd64\viostor.inf: The driver package was successfully installed.
Installing 85 of 91 - C:\Temp\drivers\viostor\w7\x86\viostor.inf: The driver package was successfully installed.
Installing 86 of 91 - C:\Temp\drivers\viostor\w8.1\amd64\viostor.inf: The driver package was successfully installed.
Installing 87 of 91 - C:\Temp\drivers\viostor\w8.1\x86\viostor.inf: The driver package was successfully installed.
Installing 88 of 91 - C:\Temp\drivers\viostor\w8\amd64\viostor.inf: The driver package was successfully installed.
Installing 89 of 91 - C:\Temp\drivers\viostor\w8\x86\viostor.inf: The driver package was successfully installed.
Installing 90 of 91 - C:\Temp\drivers\viostor\xp\amd64\viostor.inf: The driver package was successfully installed.
Installing 91 of 91 - C:\Temp\drivers\viostor\xp\x86\viostor.inf: The driver package was successfully installed.
The operation completed successfully.
2022-12-22 09:44:51 - Adding Virtual IO Drivers: C:\Temp\drivers\...
2022-12-22 09:44:51 - Getting Virtual IO Drivers: C:\Temp\drivers\...
2022-12-22 09:44:51 - Finished to get IO Drivers.
2022-12-22 09:44:52 - Adding drivers from "C:\Temp\drivers\\balloon\w10\AMD64" to image "G:\"
Deployment Image Servicing and Management tool
Version: 10.0.19041.844
Image Version: 10.0.19044.1288
Searching for driver packages to install...
Found 1 driver package(s) to install.
Installing 1 of 1 - oem7.inf: The driver package was successfully installed.
The operation completed successfully.
2022-12-22 09:44:55 - Adding drivers from "C:\Temp\drivers\\netkvm\w10\AMD64" to image "G:\"
Deployment Image Servicing and Management tool
Version: 10.0.19041.844
Image Version: 10.0.19044.1288
Searching for driver packages to install...
Found 1 driver package(s) to install.
Installing 1 of 1 - oem20.inf: The driver package was successfully installed.
The operation completed successfully.
2022-12-22 09:44:58 - Adding drivers from "C:\Temp\drivers\\viostor\w10\AMD64" to image "G:\"
Deployment Image Servicing and Management tool
Version: 10.0.19041.844
Image Version: 10.0.19044.1288
Searching for driver packages to install...
Found 1 driver package(s) to install.
Installing 1 of 1 - oem3.inf: The driver package was successfully installed.
The operation completed successfully.
2022-12-22 09:45:01 - Virtual IO Drivers was added.
2022-12-22 09:45:01 - Running offline dism Cleanup-Image...
Deployment Image Servicing and Management tool
Version: 10.0.19041.844
Image Version: 10.0.19044.1288
[=========== 20.0% ]
The operation completed successfully.
2022-12-22 09:45:06 - Offline dism Cleanup-Image completed.
2022-12-22 09:45:12 - Convert Virtual Disk: C:\Users\test\Desktop\win-golden.vhdx...
2022-12-22 09:45:12 - Converting virtual disk image from C:\Users\test\Desktop\win-golden.vhdx to C:\Users\test\Desktop\win-golden.QCOW2...
False
2022-12-22 09:46:13 - Finish to convert virtual disk.
2022-12-22 09:46:14 - Cloud image generation finished. Image path: C:\Users\test\Desktop\win-golden.qcow2
Hello @MercifulCamel,
Has the issue been resolved?
From the logs you have shared, there is an issue with the access to the folder --> The process cant access file C:\UnattendResources because it's being used by another process.
. Maybe an issue with the nvidia installer that you are trying to use?
Thank you,
Adrian Vladu