When I run the below code in Powershell ISE everything runs fine, but when I run it from Powershell Shell I get a lot of errors about icons.
[System.Reflection.Assembly]::LoadWithPartialName("System.windows.forms") |Out-Null
$foldername = New-Object System.Windows.Forms.FolderBrowserDialog
$foldername.Description = "Select a folder"
$foldername.rootfolder = "MyComputer"
$foldername.SelectedPath = $initialDirectory
if($foldername.ShowDialog() -eq "OK")
{
$folder += $foldername.SelectedPath
}
$folder
Example of Errors:
2021-10-19 15:44:43,174 ERROR - 4600 Unable to get icon for location (The operation completed successfully.): C:\Users\adalton\Pictures\Camera Roll
2021-10-19 15:44:43,176 ERROR - 4600 Unable to get icon for location (The operation completed successfully.): C:\Users\adalton\Pictures\Saved Pictures
C:\Users\adalton\Pictures\Saved Pictures