Monday, July 01, 2013

Quick Script: Is Volume Shadow Copy Enabled?


#Check for ShadowCopy
    $AllShadows = Get-WmiObject Win32_ShadowCopy  | Sort InstallDate | Select -last 1

    If($AllShadows -ne $null)
    { 
        Write-Host "[X] Volume Shadow Copy"
        $AllShadows |        Format-Table -AutoSize __SERVER,  @{LABEL="Latest Shadow Copy"; EXPRESSION = {$_.convertToDateTime($_.InstallDate)}}
     }
    Else
    {  Write-Host "[ ] Volume Shadow Copy"  } 

5 comments:

  1. Anonymous7:32 AM

    Hi Kevin,

    thanks for the useful script, if i understand it correctly the script will extract list of servers which have shadowcopy enabled? however when i try to run it i get the following error message
    GWMI: Initialization Failure
    At line:1 Char:28

    ReplyDelete
  2. Will this check all the servers in the environment for Volume shadow copy?
    I am getting the following error
    GWMI : Initialization Failure
    At Line:1 Char:28

    I want to know which servers have VSS enabled on C drive which is the system drive

    ReplyDelete
  3. You have to run it as administrator. with out the administrator context, it will not initialize correctly. To make sure you have the class in WMI, run this command.
    Get-WmiObject -List | Select-String "shadow"

    ReplyDelete
  4. Hello Kevin,

    I'm really hope you're reading this comment, could'nt find your email to contact you directly, well 1st i want to thank you for this quick script,
    though i need help with running this script against multiple computers, try to modify it but yet no sucess, please help me with this if possible, my target is to check if shadowcopy is enable on multiple computers, with the computername in a var
    $computername="multiple computers"

    thanks a lot,

    ReplyDelete
  5. hello and thanks for your help,
    i hope you read this comment,
    can you help me with running this script against multiple computers?
    i have a var $computername with multiple computernames, how can this be done?
    thank you and appreciate your help

    ReplyDelete