|
|
@ -2406,6 +2406,11 @@ function BrowsingHistory |
|
|
|
$Show |
|
|
|
) |
|
|
|
|
|
|
|
if ((Get-CimInstance -ClassName CIM_OperatingSystem).BuildNumber -lt 23451) |
|
|
|
{ |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
switch ($PSCmdlet.ParameterSetName) |
|
|
|
{ |
|
|
|
"Hide" |
|
|
@ -7002,11 +7007,8 @@ function Set-UserShellFolderLocation |
|
|
|
.SYNOPSIS |
|
|
|
Change the location of the each user folder using SHSetKnownFolderPath function |
|
|
|
|
|
|
|
.PARAMETER RemoveDesktopINI |
|
|
|
The RemoveDesktopINI argument removes desktop.ini in the old user shell folder |
|
|
|
|
|
|
|
.EXAMPLE |
|
|
|
Set-UserShellFolder -UserFolder Desktop -FolderPath "$env:SystemDrive:\Desktop" -RemoveDesktopINI |
|
|
|
Set-UserShellFolder -UserFolder Desktop -FolderPath "$env:SystemDrive:\Desktop" |
|
|
|
|
|
|
|
.LINK |
|
|
|
https://docs.microsoft.com/en-us/windows/win32/api/shlobj_core/nf-shlobj_core-shgetknownfolderpath |
|
|
@ -7026,11 +7028,7 @@ function Set-UserShellFolderLocation |
|
|
|
|
|
|
|
[Parameter(Mandatory = $true)] |
|
|
|
[string] |
|
|
|
$FolderPath, |
|
|
|
|
|
|
|
[Parameter(Mandatory = $false)] |
|
|
|
[switch] |
|
|
|
$RemoveDesktopINI |
|
|
|
$FolderPath |
|
|
|
) |
|
|
|
|
|
|
|
<# |
|
|
@ -7149,10 +7147,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int |
|
|
|
} |
|
|
|
|
|
|
|
# Removing old desktop.ini |
|
|
|
if ($RemoveDesktopINI) |
|
|
|
{ |
|
|
|
Remove-Item -Path "$CurrentUserFolderPath\desktop.ini" -Force -ErrorAction Ignore |
|
|
|
} |
|
|
|
|
|
|
|
Set-KnownFolderPath -KnownFolder $UserFolder -Path $FolderPath |
|
|
|
New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name $UserShellFoldersGUIDs[$UserFolder] -PropertyType ExpandString -Value $FolderPath -Force |
|
|
@ -7196,7 +7191,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int |
|
|
|
{ |
|
|
|
{$DriveLetters -contains $Choice} |
|
|
|
{ |
|
|
|
Set-UserShellFolder -UserFolder Desktop -FolderPath "$($Choice)\Desktop" -RemoveDesktopINI |
|
|
|
Set-UserShellFolder -UserFolder Desktop -FolderPath "$($Choice)\Desktop" |
|
|
|
} |
|
|
|
$Skip |
|
|
|
{ |
|
|
@ -7224,7 +7219,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int |
|
|
|
{ |
|
|
|
{$DriveLetters -contains $Choice} |
|
|
|
{ |
|
|
|
Set-UserShellFolder -UserFolder Documents -FolderPath "$($Choice)\Documents" -RemoveDesktopINI |
|
|
|
Set-UserShellFolder -UserFolder Documents -FolderPath "$($Choice)\Documents" |
|
|
|
} |
|
|
|
$Skip |
|
|
|
{ |
|
|
@ -7252,7 +7247,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int |
|
|
|
{ |
|
|
|
{$DriveLetters -contains $Choice} |
|
|
|
{ |
|
|
|
Set-UserShellFolder -UserFolder Downloads -FolderPath "$($Choice)\Downloads" -RemoveDesktopINI |
|
|
|
Set-UserShellFolder -UserFolder Downloads -FolderPath "$($Choice)\Downloads" |
|
|
|
} |
|
|
|
$Skip |
|
|
|
{ |
|
|
@ -7280,7 +7275,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int |
|
|
|
{ |
|
|
|
{$DriveLetters -contains $Choice} |
|
|
|
{ |
|
|
|
Set-UserShellFolder -UserFolder Music -FolderPath "$($Choice)\Music" -RemoveDesktopINI |
|
|
|
Set-UserShellFolder -UserFolder Music -FolderPath "$($Choice)\Music" |
|
|
|
} |
|
|
|
$Skip |
|
|
|
{ |
|
|
@ -7308,7 +7303,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int |
|
|
|
{ |
|
|
|
{$DriveLetters -contains $Choice} |
|
|
|
{ |
|
|
|
Set-UserShellFolder -UserFolder Pictures -FolderPath "$($Choice)\Pictures" -RemoveDesktopINI |
|
|
|
Set-UserShellFolder -UserFolder Pictures -FolderPath "$($Choice)\Pictures" |
|
|
|
} |
|
|
|
$Skip |
|
|
|
{ |
|
|
@ -7336,7 +7331,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int |
|
|
|
{ |
|
|
|
{$DriveLetters -contains $Choice} |
|
|
|
{ |
|
|
|
Set-UserShellFolder -UserFolder Videos -FolderPath "$($Choice)\Videos" -RemoveDesktopINI |
|
|
|
Set-UserShellFolder -UserFolder Videos -FolderPath "$($Choice)\Videos" |
|
|
|
} |
|
|
|
$Skip |
|
|
|
{ |
|
|
@ -7377,7 +7372,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int |
|
|
|
|
|
|
|
if ($FolderBrowserDialog.SelectedPath) |
|
|
|
{ |
|
|
|
Set-UserShellFolder -UserFolder Desktop -FolderPath "$($FolderBrowserDialog.SelectedPath)\Desktop" -RemoveDesktopINI |
|
|
|
Set-UserShellFolder -UserFolder Desktop -FolderPath $FolderBrowserDialog.SelectedPath |
|
|
|
} |
|
|
|
} |
|
|
|
$Skip |
|
|
@ -7417,7 +7412,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int |
|
|
|
|
|
|
|
if ($FolderBrowserDialog.SelectedPath) |
|
|
|
{ |
|
|
|
Set-UserShellFolder -UserFolder Documents -FolderPath "$($FolderBrowserDialog.SelectedPath)\Documents)" -RemoveDesktopINI |
|
|
|
Set-UserShellFolder -UserFolder Documents -FolderPath $FolderBrowserDialog.SelectedPath |
|
|
|
} |
|
|
|
} |
|
|
|
$Skip |
|
|
@ -7457,7 +7452,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int |
|
|
|
|
|
|
|
if ($FolderBrowserDialog.SelectedPath) |
|
|
|
{ |
|
|
|
Set-UserShellFolder -UserFolder Downloads -FolderPath "$($FolderBrowserDialog.SelectedPath)\Downloads)" -RemoveDesktopINI |
|
|
|
Set-UserShellFolder -UserFolder Downloads -FolderPath $FolderBrowserDialog.SelectedPath |
|
|
|
} |
|
|
|
} |
|
|
|
$Skip |
|
|
@ -7497,7 +7492,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int |
|
|
|
|
|
|
|
if ($FolderBrowserDialog.SelectedPath) |
|
|
|
{ |
|
|
|
Set-UserShellFolder -UserFolder Music -FolderPath "$($FolderBrowserDialog.SelectedPath)\Music)" -RemoveDesktopINI |
|
|
|
Set-UserShellFolder -UserFolder Music -FolderPath $FolderBrowserDialog.SelectedPath |
|
|
|
} |
|
|
|
} |
|
|
|
$Skip |
|
|
@ -7537,7 +7532,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int |
|
|
|
|
|
|
|
if ($FolderBrowserDialog.SelectedPath) |
|
|
|
{ |
|
|
|
Set-UserShellFolder -UserFolder Pictures -FolderPath "$($FolderBrowserDialog.SelectedPath)\Pictures)" -RemoveDesktopINI |
|
|
|
Set-UserShellFolder -UserFolder Pictures -FolderPath $FolderBrowserDialog.SelectedPath |
|
|
|
} |
|
|
|
} |
|
|
|
$Skip |
|
|
@ -7577,7 +7572,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int |
|
|
|
|
|
|
|
if ($FolderBrowserDialog.SelectedPath) |
|
|
|
{ |
|
|
|
Set-UserShellFolder -UserFolder Videos -FolderPath "$($FolderBrowserDialog.SelectedPath)\Videos)" -RemoveDesktopINI |
|
|
|
Set-UserShellFolder -UserFolder Videos -FolderPath $FolderBrowserDialog.SelectedPath |
|
|
|
} |
|
|
|
} |
|
|
|
$Skip |
|
|
@ -7609,7 +7604,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int |
|
|
|
{ |
|
|
|
$Yes |
|
|
|
{ |
|
|
|
Set-UserShellFolder -UserFolder Desktop -FolderPath "$env:USERPROFILE\Desktop" -RemoveDesktopINI |
|
|
|
Set-UserShellFolder -UserFolder Desktop -FolderPath "$env:USERPROFILE\Desktop" |
|
|
|
} |
|
|
|
$Skip |
|
|
|
{ |
|
|
@ -7638,7 +7633,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int |
|
|
|
{ |
|
|
|
$Yes |
|
|
|
{ |
|
|
|
Set-UserShellFolder -UserFolder Documents -FolderPath "$env:USERPROFILE\Documents" -RemoveDesktopINI |
|
|
|
Set-UserShellFolder -UserFolder Documents -FolderPath "$env:USERPROFILE\Documents" |
|
|
|
} |
|
|
|
$Skip |
|
|
|
{ |
|
|
@ -7667,7 +7662,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int |
|
|
|
{ |
|
|
|
$Yes |
|
|
|
{ |
|
|
|
Set-UserShellFolder -UserFolder Downloads -FolderPath "$env:USERPROFILE\Downloads" -RemoveDesktopINI |
|
|
|
Set-UserShellFolder -UserFolder Downloads -FolderPath "$env:USERPROFILE\Downloads" |
|
|
|
} |
|
|
|
$Skip |
|
|
|
{ |
|
|
@ -7696,7 +7691,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int |
|
|
|
{ |
|
|
|
$Yes |
|
|
|
{ |
|
|
|
Set-UserShellFolder -UserFolder Music -FolderPath "$env:USERPROFILE\Music" -RemoveDesktopINI |
|
|
|
Set-UserShellFolder -UserFolder Music -FolderPath "$env:USERPROFILE\Music" |
|
|
|
} |
|
|
|
$Skip |
|
|
|
{ |
|
|
@ -7725,7 +7720,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int |
|
|
|
{ |
|
|
|
$Yes |
|
|
|
{ |
|
|
|
Set-UserShellFolder -UserFolder Pictures -FolderPath "$env:USERPROFILE\Pictures" -RemoveDesktopINI |
|
|
|
Set-UserShellFolder -UserFolder Pictures -FolderPath "$env:USERPROFILE\Pictures" |
|
|
|
} |
|
|
|
$Skip |
|
|
|
{ |
|
|
@ -7754,7 +7749,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int |
|
|
|
{ |
|
|
|
$Yes |
|
|
|
{ |
|
|
|
Set-UserShellFolder -UserFolder Videos -FolderPath "$env:USERPROFILE\Videos" -RemoveDesktopINI |
|
|
|
Set-UserShellFolder -UserFolder Videos -FolderPath "$env:USERPROFILE\Videos" |
|
|
|
} |
|
|
|
$Skip |
|
|
|
{ |
|
|
|