Windows File System Redirector with Chef Client/Ruby

I was recently using the windows_zipfile resource to unzip content to the path C:\Windows\System32\WindowsPowerShell\v1.0\Modules as part of a recipe in a Chef cookbook which would complete successfully, but on observation would unzip the contents to C:\Windows\SysWow64\WindowsPowerShell\v1.0\Modules and cause an error when further resources references this source.

The cause of this behaviour is due to the the chef-client and ruby versions are running as 32-bit and the file system redirector redirects access to C:\Windows\SysWow64 instead of C:\Windows\System32.

In order to workaround this issue we can substitute C:\Windows\Sysnative for C:\Windows\System32, by using this alias the file system redirection is bypassed.

In my example, I modified my original resource in the recipie to now include the alias.

windows_zipfile 'C:/Windows/System32/WindowsPowershell/v1.0/Modules/' do 
windows_zipfile 'C:/Windows/Sysnative/WindowsPowershell/v1.0/Modules/' do

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s