Convert WindowsImage PS1 File: Difference between revisions

No edit summary
No edit summary
Line 8: Line 8:
</syntaxhighlight>
</syntaxhighlight>


== Problem #2; No error message and it still won't run ==
== Problem #2; No error message after using the Set-Execution command and it still won't run ==
</div>This issue was related to all of the restrictions and protections Microsoft puts in place to protect us from all the evil in the world and at the same time make the PowerShell completely dysfunctional (or so it seems).  You've might have already read about and tried the Set-Execution Policy to Unrestricted or Bypass and still have nothing work as happened to me.  The key to figuring this out was a simple comment by a contributor on a forum.  He said, "...downloaded from the internet."  That made me think about these warning dialogs in Windows 10 that would pop up when I opened videos, music files, graphics, or anything else downloaded from the internet that put up an extra warning alluding to the file being from the internet and asking if I really wanted to open the file.
</div>This issue was related to all of the restrictions and protections Microsoft puts in place to protect us from all the evil in the world and at the same time make the PowerShell completely dysfunctional (or so it seems).  You've might have already read about and tried the Set-Execution Policy to Unrestricted or Bypass and still have nothing work as happened to me.  The key to figuring this out was a simple comment by a contributor on a forum.  He said, "...downloaded from the internet."  That made me think about these warning dialogs in Windows 10 that would pop up when I opened videos, music files, graphics, or anything else downloaded from the internet that put up an extra warning alluding to the file being from the internet and asking if I really wanted to open the file.


I did download the Convert-WindowsImage.ps1 file from the internet, but wait, it's just a text file, why don't I just create a new text file on my computer and copy and paste the contents of the original file into the new one? So I did.  And it worked as the new file I created wasn't downloaded from the internet, but whose origins were local on my computer.
I did download the Convert-WindowsImage.ps1 file from the internet, but wait, it's just a text file, why don't I just create a new text file on my computer and copy and paste the contents of the original file into the new one? So I did.  And it worked as the new file I created wasn't downloaded from the internet, but whose origins were local on my computer.
== Problem #3; Similar to #2 with no error message  and it still won't run ==
Another tip from another contributor on some forum noted that the entire Convert-WindowsImage.ps1 file was written as a Function.  Go ahead, open up the file in a text editor and even if you don't know anything about programming, you'll see that 'Function' delimiter right at the top. In layman's terms it means if you type .\Convert-WindowsImage.ps1, it won't work.  Maybe it did in the past (prior to 2018) with other versions of this script or other version of Windows, which is why there are so many sites that instruct one to simply type .\Convert-WindowsImage.ps1 and you'll be on your merry way.  But if you're trying this in 2018 or later and using the latest version of the script.