-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Description
Prerequisites
- Write a descriptive title.
- Make sure you are able to repro it on the latest released version
- Search the existing issues.
- Refer to the FAQ.
- Refer to Differences between Windows PowerShell 5.1 and PowerShell.
Steps to reproduce
While testing deleting symbolic links with Remove-Item in Windows PowerShell I ran in to issues and switched to PowerShell 7.3.4, where the command ran as expected, until I realized it deleted the files even though I had used the -WhatIf parameter.
Specifically I was deleting a symbolic link, but I also tested it on a junction point.
The actual command:
Remove-Item "$_\Documents" -force -whatif$_ contained the directory info object of a user's folder on a file store. I was using the local file store at the time, so a local hard drive, not UNC paths.
I believe Windows PowerShell has the same issue, as it was providing an error regarding deleting the symbolic link after printing the verbose 'whatif:' response, due to some mismatch of tag information.
Expected behavior
Expected the file/folder to not be deleted.
Actual behavior
Folder was deleted even though the verbose output indicated 'whatif:'
What if: Performing the operation "Remove Directory" on target "E:\Shares\Users Folders\RNE_LdrFF\Documents".Error details
No response
Environment data
Name Value
---- -----
PSVersion 7.3.4
PSEdition Core
GitCommitId 7.3.4
OS Microsoft Windows 10.0.17763
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0Visuals
No response