Forum Discussion

desert_lizard's avatar
desert_lizard
Copper Contributor
Sep 27, 2024

shadowcopy

I see when I type

wmic /?

it shows me wmi options for shadowcopy.  Thats great if using the deprecated WMI tool.

Leads me to,  so I can pull shadowcopy information using WMI tool, what about PS?  

When I search for shadowcopy with powershell,  I find nothing.  If there is some shadowcopy hooks in powershell what are they?   And can we make them easier to find?

seaching all PS docs using below comes up with nothing!

Import-Module (Microsoft.PowerShell.Core) - PowerShell | Microsoft Learn\

Thanks!

Rod

 

2 Replies

  • Hi,

    To work with shadowcopy in PowerShell, you can utilize WMI (Windows Management Instrumentation) classes through PowerShell. Specifically, the Win32_ShadowCopy WMI class provides access to shadowcopy-related operations.

     

     

    1. List Shadow Copies:

    Get-WmiObject -Class Win32_ShadowCopy

    2. Create a Shadow Copy:

    (Get-WmiObject -List Win32_ShadowCopy).Create("C:\", "ClientAccessible")

    3. Delete a Shadow Copy:

    (Get-WmiObject -Class Win32_ShadowCopy | Where-Object { $_.ID -eq 'shadowcopyID' }).Delete()


    Best Regards,

    Ali Koc
     

  • Vern_Anderson's avatar
    Vern_Anderson
    Copper Contributor

    desert_lizard 

     

    You can try this. . .

     

    Get-WMIObject -List *shad*

     

    That will list all WMI classes that contain the string shad. In my case I found all kinds of classes related to Shadow Copy including Win32_ShadowCopy which is likely what you are looking for but if you don't find you answer there try some of the others. I use this method to find WMI classes all the time. However, we should both be switching to CIM someday, you know for when we switch to using PowerShell 7 from a MAC which will never happen for me.

Resources