PowerShell desktop background script fails on 64-bit Windows 7

  • Thread starter Nate Duong
  • Start date
7 replies · 2K views · last reply
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?
Windows PowerShell console in red text on black, reporting that running scripts is disabled and the script ChangeDesktopOffice.ps1 cannot be loaded, followed by 'The system cannot find the path specified.'
Console window showing red PowerShell error: file C:\FINDER_PGM\ChangeDesktopOffice.ps1 cannot be loaded because execution of scripts is disabled on this system, with PSSecurityException and RuntimeException details, followed by '1 file(s) copied.' and 'Press any key to continue'.
Screenshot of C# source code in a text editor defining a Wallpaper.Setter class with a SetWallpaper method, using user32.dll SystemParametersInfo and registry keys, followed by a PowerShell call SetWallpaper with a .bmp path.

Thank you,

Nate Duong.
 
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   Reactions: Imager