Created
June 16, 2023 12:25
-
-
Save ojgarciab/4528eb83f85d152def94fdff8db0ffd0 to your computer and use it in GitHub Desktop.
Crear y usar copias "shadow" para acceder a archivos en uso
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Documentación: | |
# https://learn.microsoft.com/en-us/previous-versions/windows/desktop/legacy/aa394428(v=vs.85) | |
# Creamos la copia | |
$shadow = (Get-WmiObject -List Win32_ShadowCopy).Create("C:\\", "ClientAccessible") | |
$shadow2 = Get-WmiObject Win32_ShadowCopy | Where-Object { $_.ID -eq $shadow.ShadowID } | |
$dispositivo = $shadow2.DeviceObject + "\\" | |
cmd /c mklink /d C:\shadowcopy "$dispositivo" | |
# Acceso a los datos desde C:\shadowcopy | |
# ... | |
# Borramos la copia | |
Remove-Item c:\shadowcopy -Confirm:$false -Force | |
$dispositivo.Delete() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment