|
./Get-Windows10LockScreenWallpapers
Runs the script. Please notice to insert ./ or .\ before the script name. If the default -Output parameter folder "$($env:USERPROFILE)\Pictures\Wallpapers " doesn't seem to exist, the user will be queried, whether the -Output folder should be created or not. Will query "$($env:USERPROFILE)\Pictures\Wallpapers " and the default subfolder ("$($env:USERPROFILE)\Pictures\Wallpapers\Vertical ") for existing files, and calculates their SHA256 hash values. Uses one of the three available methods to retrieve the Windows Spotlight lock screen wallpapers and compares their SHA256 hash values against the hash values of the files in the -Output folder to determine, whether any new files are present or not. All new landscape images are then copied to the default -Output parameter folder ("$($env:USERPROFILE)\Pictures\Wallpapers "), and all the new portrait images are copied to the default subfolder of the portrait pictures ("$($env:USERPROFILE)\Pictures\Wallpapers\Vertical "). A pop-up window showing the new files will open, if new files were found.
help ./Get-Windows10LockScreenWallpapers -Full
Displays the help file.
./Get-Windows10LockScreenWallpapers.ps1 -Log -Audio -Open -ExcludePortrait -Force
Runs the script and creates the default -Output folder, if it doesn't exist, since the -Force was used. Also, since the -Force was used, the default File Manager will be opened at the default -Output folder regardless whether any new files were found or not. Uses one of the three available methods for retrieving the Windows Spotlight lock screen wallpapers and compares their SHA256 hash values against the hash values found in the default -Output folder to determine, whether any new files are present or not. Since the -ExcludePortrait parameter was used, the results are limited to the landscape wallpapers, and the vertical portrait pictures are excluded from the images to be processed further. If new landscape (horizontal) images were found, after the new landscape wallpapers are copied to their default destination, a log file creation/updating procedure is initiated, and a CSV-file (spotlight_log.csv ) is created/updated at the default -Output folder. Furthermore, if new files were indeed found, an audible beep will occur.
./Get-Windows10LockScreenWallpapers -Output C:\Users\Dropbox\ -Subfolder dc01 -Include
Uses one or two of the three available methods (registry, estimation and current lock screen hive) as the basis for determining the source paths, where the Windows Spotlight lock screen wallpapers are stored locally. Since the -IncludeHive parameter was used, the third method of wallpaper searching will be used in any case, which usually means that that the contents of '$env:windir\Web\Screen ' are also used as a source. Compares the SHA256 hash values of the found files against the hash values found in the "C:\Users\Dropbox\ " and "C:\Users\Dropbox\dc01 " folders to determine, whether any new files are present or not. All new landscape images are then copied to the "C:\Users\Dropbox\ " folder, and all the new portrait images are copied to the "C:\Users\Dropbox\dc01 " subfolder. Since the path or the subfolder name doesn't contain any space characters, they don't need to be enveloped with quotation marks. Furthermore, the word -Output may be left out from the command as well, because -Output values are read automatically from the first parameter position.
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope LocalMachine
This command is altering the Windows PowerShell rights to enable script execution in the default (LocalMachine ) scope, and defines the conditions under which Windows PowerShell loads configuration files and runs scripts in general. In Windows Vista and later versions of Windows, for running commands that change the execution policy of the LocalMachine scope, Windows PowerShell has to be run with elevated rights (Run as Administrator). The default policy of the default (LocalMachine ) scope is "Restricted ", and a command "Set-ExecutionPolicy Restricted " will "undo" the changes made with the original example above (had the policy not been changed before). Execution policies for the local computer (LocalMachine ) and for the current user (CurrentUser ) are stored in the registry (at for instance the HKLM:\Software\Policies\Microsoft\Windows\PowerShell\ExecutionPolicy key), and remain effective until they are changed again. The execution policy for a particular session (Process ) is stored only in memory, and is discarded when the session is closed.
Parameters:
Restricted |
Does not load configuration files or run scripts, but permits individual commands. Restricted is the default execution policy. |
AllSigned |
Scripts can run. Requires that all scripts and configuration files be signed by a trusted publisher, including the scripts that have been written on the local computer. Risks running signed, but malicious, scripts. |
RemoteSigned |
Requires a digital signature from a trusted publisher on scripts and configuration files that are downloaded from the Internet (including e-mail and instant messaging programs). Does not require digital signatures on scripts that have been written on the local computer. Permits running unsigned scripts that are downloaded from the Internet, if the scripts are unblocked by using the Unblock-File cmdlet. Risks running unsigned scripts from sources other than the Internet and signed, but malicious, scripts. |
Unrestricted |
Loads all configuration files and runs all scripts. Warns the user before running scripts and configuration files that are downloaded from the Internet. Not only risks, but actually permits, eventually, running any unsigned scripts from any source. Risks running malicious scripts. |
Bypass |
Nothing is blocked and there are no warnings or prompts. Not only risks, but actually permits running any unsigned scripts from any source. Risks running malicious scripts. |
Undefined |
Removes the currently assigned execution policy from the current scope. If the execution policy in all scopes is set to Undefined , the effective execution policy is Restricted , which is the default execution policy. This parameter will not alter or remove the ("master") execution policy that is set with a Group Policy setting. |
Notes: |
- Please note, that the Group Policy setting "
Turn on Script Execution " overrides the execution policies set in Windows PowerShell in all scopes. To find this ("master") setting, please, for example, open the Local Group Policy Editor (gpedit.msc ) and navigate to Computer Configuration → Administrative Templates → Windows Components → Windows PowerShell.
|
|
- The Local Group Policy Editor (
gpedit.msc ) is not available in any Home or Starter editions of Windows.
Group Policy Setting "Turn on Script Execution " |
PowerShell Equivalent (concerning all scopes) |
Not configured |
No effect, the default value of this setting |
Disabled |
Restricted |
Enabled - Allow only signed scripts |
AllSigned |
Enabled - Allow local scripts and remote signed scripts |
RemoteSigned |
Enabled - Allow all scripts |
Unrestricted |
|
For more information, please type "Get-ExecutionPolicy -List ", "help Set-ExecutionPolicy -Full ", "help about_Execution_Policies " or visit Set-ExecutionPolicy or about_Execution_Policies.
New-Item -ItemType File -Path C:\Temp\Get-Windows10LockScreenWallpapers.ps1
Creates an empty ps1-file to the C:\Temp directory. The New-Item cmdlet has an inherent -NoClobber mode built into it, so that the procedure will halt, if overwriting (replacing the contents) of an existing file is about to happen. Overwriting a file with the New-Item cmdlet requires using the Force . If the path name and/or the filename includes space characters, please enclose the whole -Path parameter value in quotation marks (single or double):
New-Item -ItemType File -Path "C:\Folder Name\Get-Windows10LockScreenWallpapers.ps1"
For more information, please type "help New-Item -Full ".
|