I faced with problem during writing of powershell script. I should copy 3 .dll file to C:\Windows\SYSWOW64 folder from poweshell 64-bit process. If I use environment variable
$systemFolder = [System.Environment]::SystemDirectory
So, under 64-bit process on 64 bit system
$systemFolder = "C:\Windows\system32"
Is any enviroment variable or some construction to get access to SYSWOW64 folder. I came up with such solution, but I think there is more correct solution
$targetFolder = [System.Environment]::SystemDirectory
if([Environment]::Is64BitProcess){
$targetFolder = "$env:windir\SYSWOW64"
}
Many thanks
I don't see a problem with that solution, but another option for you might be to run your script in a 32bit proccess, you can do this by runnning as a job using Start-Job and the RunAs32 parameter.
Another option is to use Environment.SpecialFolder