Solve PowerShell Issues Quickly with Expert Help

  • Thread starter Thread starter Nate Duong
  • Start date Start date
AI Thread Summary
To automatically change the desktop background using PowerShell on a 64-bit Windows 7 system, it is essential to ensure that the correct version of any required DLLs is used, as 32-bit DLLs will not function on a 64-bit system. If the script runs successfully when executed directly in PowerShell but fails when called from a .bat file, it may be due to execution policy restrictions. Setting the execution policy to "Unrestricted" in PowerShell can resolve this issue. Additionally, running the .bat file as an administrator may be necessary. For users seeking to simplify the process, there are alternative methods available for setting up rotating desktop backgrounds.
Nate Duong
Messages
125
Reaction score
4
Dear Group,
I am trying to use powershell to automatically change desktop back ground,

I had code and it worked (windows7 with 32 bit), but when I tried to put into different computer (windows7 with 64 bit) the code did not work and it showed the message. (images 1a and 1b below),

Do you have any ideal to help me out? I also have an image which code is included?
1a.JPG
1b.JPG
1c.JPG

Thank you,

Nate Duong.
 
Computer science news on Phys.org
Your code shows that you're attempting to use a 32 bit dll on your 64 bit system. Do you have a 64 bit version that you can use instead?
 
Borg said:
Your code shows that you're attempting to use a 32 bit dll on your 64 bit system. Do you have a 64 bit version that you can use instead?
Borg,
If I do not have it, how can I download powershell version with 64 bit?
 
Borg said:
Your code shows that you're attempting to use a 32 bit dll on your 64 bit system. Do you have a 64 bit version that you can use instead?
Actually, when I right click and choose option "run with powershell". the software is run fine.

But when I created .bat file such as:

@Echo off
powershell.exe C:\Users\ngoc\Desktop\FINDER_PGM\ChangeDesktopOffice.ps1
cd c:\finder_pgm\radarcmd_finder
copy office.rdf default.rdf

the CMD window showed up and showed that message.

Do you have any ideal?

Thank you, Borg
 
Nate Duong said:
Actually, when I right click and choose option "run with powershell". the software is run fine.

But when I created .bat file such as:

@Echo off
powershell.exe C:\Users\ngoc\Desktop\FINDER_PGM\ChangeDesktopOffice.ps1
cd c:\finder_pgm\radarcmd_finder
copy office.rdf default.rdf

the CMD window showed up and showed that message.

Do you have any ideal?

Thank you, Borg
Have you tried running the .bat file as an administrator?
 
Borg said:
Have you tried running the .bat file as an administrator?
yes, I have tried with administrator, it showed the same message.
 
Then I'm not sure what the answer is. I haven't worked much with the power shell tools. I tried a simple Google search and ran across this article on Power Shell Versions. You do need to take care with respect to the 32 and 64 bit operating systems.
 
  • Like
Likes Imager
Back
Top