[
    {
        "role": "user",
        "content": "Is%20there%20a%20powershell%20way%20to%20querry%20the%20windows%2010%20current%20backup%20settings%20and%20then%20a%20stirng%20to%20start%20it.%20I%20shoudl%20have%20it%20setup%20to%20backup%20to%20Z%3A%20drive%20right%20now%20apecirfic%20folders%20and%20such%20and%20others%20to%20exclude"
    },
    {
        "role": "assistant",
        "content": "Yes \u2014 you can use built-in command-line tools in PowerShell or cmd to check Windows 10\u2019s current backup settings (for image-based backups) and also to start or schedule backups with specific includes/excludes. The main tool is **wbadmin**, and there are also PowerShell cmdlets under the *WindowsServerBackup* module if you're running the appropriate Windows editions. Here\u2019s a breakdown of how to do what you want.\n\n---\n\n## What \u201cbackup settings\u201d you can query\n\nThere is **no built-in Windows command or PowerShell cmdlet** that reliably reports *all* of your GUI-backup settings (like the *File History* or *OneDrive-folder sync backup*) in full detail (folders included/excluded, schedule etc.). But for **system image / bare-metal/volume backups** using **WBAdmin**, you *can* get:\n\n- Which **versions** of backups exist on a backup target drive.  \n- What **items (volumes or files/folders)** were included in a given backup.  \n- Where the **backup target** (destination) is.  \n\nUsing commands like `wbadmin get versions`, `wbadmin get items`, etc. These tools require administrator privileges. ([learn.microsoft.com](https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/wbadmin-get-items?utm_source=openai))\n\n---\n\n## How to start an image backup via PowerShell/cmd\n\nUsing **wbadmin**, you can launch a backup with exactly the options you want: target drive, which volumes/folders to include, whether to include \u201ccritical\u201d system stuff, scheduling, excludes etc.\n\n### Basic example to start a one-time backup:\n\n```powershell\nwbadmin start backup -backupTarget:Z: -include:C: -allCritical -quiet\n```\n\n- `-backupTarget:Z:` sets the destination to Z:.  \n- `-include:C:` backs up the C: drive.  \n- `-allCritical` adds in necessary system & boot volumes.  \n- `-quiet` suppresses prompts.  \n- You can also specify multiple includes (e.g. `-include:C:,D:\\MyFolder`) and use `-vssFull` or `-vssCopy` for full or copy VSS style backups. ([techtarget.com](https://www.techtarget.com/data-technologies/tip/Wbadmin-backup-tips-for-backing-up-Windows?utm_source=openai))\n\n### Scheduling a recurring backup\n\nYou can set up a scheduled backup with `wbadmin enable backup`:\n\n```powershell\nwbadmin enable backup -addtarget:Z: -schedule:23:00 -include:C: -allCritical -quiet\n```\n\nThis enables scheduled backups to Z: drive every night at 11pm including C: plus critical volumes. ([github.com](https://github.com/armourinfosec/Enterprise-Windows-Infrastructure-Security/blob/main/Windows-Server-Backup-Restore-and-Recovery/Readme.md?utm_source=openai))\n\n---\n\n## Querying the current policy/settings for image backups\n\nHere are some commands you can run (in an elevated PowerShell or cmd prompt) to get the current WBAdmin settings:\n\n```powershell\nwbadmin get versions\n```\n\u2192 List all backup versions available at your backup target(s). Tells you date/time, size, etc. ([learn.microsoft.com](https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/wbadmin-get-items?utm_source=openai))\n\n```powershell\nwbadmin get items -version:<VersionIdentifier>\n```\n(You replace `<VersionIdentifier>` with a version from the versions list.)\n\n\u2192 Shows what volumes or files are in that backup version. ([learn.microsoft.com](https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/wbadmin-get-items?utm_source=openai))\n\nAlso, PowerShell\u2019s *WindowsServerBackup* module includes:\n\n```powershell\nGet-WBPolicy\n```\n\n\u2192 Gets the backup policy (what\u2019s being included, where it's stored, schedule etc.) if a WBAdmin-style policy is configured. ([github.com](https://github.com/MicrosoftDocs/windows-powershell-docs/blob/main/docset/winserver2025-ps/WindowsServerBackup/Get-WBPolicy.md?utm_source=openai))\n\n```powershell\nGet-WBJob\n```\n\n\u2192 If a backup is currently running (or recent status) using the policy. ([github.com](https://github.com/MicrosoftDocs/windows-powershell-docs/blob/main/docset/winserver2025-ps/WindowsServerBackup/Get-WBJob.md?utm_source=openai))\n\n---\n\n## Putting it together: Sample script\n\nHere\u2019s a sample PowerShell script you could use to check current settings, then run a backup to Z: drive, including \"C:\\Data\", excluding a folder, etc.\n\n```powershell\n# Run as Admin\n# 1. Check existing policy (if applicable)\nif ( Get-Command Get-WBPolicy -ErrorAction SilentlyContinue ) {\n    $policy = Get-WBPolicy\n    $policy | Format-List *\n\n    # Show backup target(s)\n    $policy.Targets\n\n    # Show included volumes and file specs\n    $policy | Select-Object -ExpandProperty Volumes\n    $policy | Select-Object -ExpandProperty FileSpecs\n}\n\n# 2. Run a one-time backup to drive Z:\n$backupDest = \"Z:\"\n$includePaths = \"C:\\Data\"\n$excludePaths = \"C:\\Data\\Temp\"\n\n# Build the wbadmin command\n$cmd = \"wbadmin start backup -backupTarget:$backupDest -include:$includePaths -allCritical -quiet\"\n# If exclude is allowed in your version:\nif ($excludePaths) {\n    $cmd += \" -exclude:$excludePaths\"\n}\n\nWrite-Host \"Running: $cmd\"\nInvoke-Expression $cmd\n\n# Optionally get job status if using PowerShell module\nif ( Get-Command Get-WBJob -ErrorAction SilentlyContinue ) {\n    Start-Sleep -Seconds 5\n    Get-WBJob\n}\n```\n\n---\n\n## Caveats & limitations\n\n- **Exclude paths**: Depending on your Windows version & whether using `-allCritical`, excludes sometimes aren\u2019t honored (some system volumes included automatically). ([reddit.com](https://www.reddit.com/r/Windows10/comments/xnq0hv?utm_source=openai))  \n- **Scheduled backups** require setting up via `wbadmin enable backup`. If you just ran one-time backups, there may be no scheduled policy.  \n- **Different backup types**: Windows 10 has *File History*, *OneDrive folder backup*, *Settings sync*, *image backup (WBAdmin) / full backup tools*. The commands above pertain to the image / full / system backup side, *not* File History or the newer \u201cWindows Backup\u201d app\u2019s settings sync.\n\n---\n\nIf you tell me *which backup system you're using now* (File History? Image backup via Control Panel or WBAdmin? Something scheduled already? U in a company or local PC?), I can give you a more exact script to match your setup."
    }
]