Open patilprakash opened 7 years ago
the artifact name is SQLServer (no space). this worked.
But I am getting this error: Get-ChildItem : Cannot find path 'HKEY_LOCAL_MACHINE\$TempKey\Microsoft\Microsoft SQL Server\Instance Names\SQL' because it does not exist. At C:\Program Files\WindowsPowerShell\Modules\Image2Docker\1.8.2\Functions\Private\Artifacts\SQLServer\Discover_SQLServer.ps1:52 char:17
+ CategoryInfo : ObjectNotFound: (HKEY_LOCAL_MACH...tance Names\SQL:String) [Get-ChildItem], ItemNotFound
Exception
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand
I have the same error. The key exists, I've checked the registry using regedit.
I've edited the script so that it looks like this $PathList = Get-ChildItem -Path 'HKLM:\Software\Microsoft\Microsoft SQL Server\Instance Names'
No errors, however the dockerfile is as below
This don't look like the correct output.
that new command may be pulling the local computers instance names (it seems like you may have a local SQL Server install too) as opposed to the mounted reg hive form the vhd image. Even if this is true, then still the output doesn't seem right..
Yes, I suspect so.
There might be something wrong with the code to load the reg hive.
I ran into this same issue. I tried andreputera's code changes, which didn't resolve the issue for me.
So I created the registry key 'HKLM:\Software\Microsoft\Microsoft SQL Server\Instance Names' on my host system and discovered that after creating that registry key on my host system andreputera's code changes then resulted in the code executing without error.
This seems to suggest that (with the code changes) the SQLServer artifact is actually pointing to the registry hive on the host machine and not the registry hive contained in the VHD.
--Edit: Further investigation, the AddRemovePrograms Artifact appears to function correctly, but also seems to be the only other function that mounts the registry from the VHD. There are some slight differences in execution, but nothing seems obviously broken.
It seems like in the registry path $TempKey is not being treated as a variable, will investigate further.
--Edit: Oh, I think I see part of the problem. Line 52: the Path has spaces so single quotes are used. However, as I understand, variables are not resolved if the string is enclosed in single quotes. So, $TempKey isn't being resolved and when the code executes it doesn't see a folder in the registry called $TempKey, so it fails.
--Edit: I can confirm that replacing the single quotes with double quotes resolves the variable resolution issue. I have also verified that the AddRemovePrograms function is pulling from the VHD. However, it appears that although the SQLServer function is finishing without error, it is not pulling the instance names. Will investigate further.
--Edit: So, replacing the single quotes with double quotes on line 52 seems to work. It is now getting SQL Server Instance Names. However, they don't appear to be the correct names at first glance.
--Edit: Okay, realized I forgot to change back the path from "HKLM:\Software\Microsoft\Microsoft SQL Server\Instance Names" to "HKLM:\Software\Microsoft\Microsoft SQL Server\Instance Names\SQL" so I was getting the subfolders inside of "Instance Names," but with it changed back it won't populate with the instance names.
--Edit: Also, it seems like $PathList should be initialized as a null array like it is in the AddRemovePrograms function, however this doesn't resolve the issue that the instances aren't being captured.
--Edit: So the reason for the instance names not being grabbed seems to do with this: https://technet.microsoft.com/en-us/library/ee176852.aspx Essentially, Get-ChildItem cannot be used to get the registry values, Get-ItemProperty needs to be used.
--Edit: Created a pull request with fixed code that has been tested and works for cases where there is one SQLServer instance. Needs to be tested with cases where there are multiple SQLServer instances.
The documentation on Docker (https://blog.docker.com/2016/12/convert-asp-net-web-servers-docker-image2docker/) suggests we can pass "SQL Server" as an artifact. I have installed and seems like I can use only IIS. I don't see the other artifact related commands in the functions folder. Are we supposed to get them from somewhere else ?