{"id":104,"date":"2014-05-15T21:35:25","date_gmt":"2014-05-15T21:35:25","guid":{"rendered":"http:\/\/www.edrockwell.com\/blog\/?p=104"},"modified":"2026-07-02T16:57:33","modified_gmt":"2026-07-02T16:57:33","slug":"ssh-powershell-backup-cisco-devices-script","status":"publish","type":"post","link":"https:\/\/www.edrockwell.com\/blog\/ssh-powershell-backup-cisco-devices-script\/","title":{"rendered":"SSH with Powershell: Backup multiple Cisco devices"},"content":{"rendered":"<p>Today, I was asked to write a script to connect to all our Cisco devices and backup the configs to our fileserver. After a few hours of figuring it out, this is what I came up with<\/p>\n<p>You ONLY need a READ ONLY account on the Cisco devices.<\/p>\n<p>We run this every day at 2:00 AM and backup many Cisco devices.<\/p>\n<p>I downloaded and use this SSH.NET Library: <a href=\"http:\/\/www.powershelladmin.com\/wiki\/SSH_from_PowerShell_using_the_SSH.NET_library\">SSH With Powershell<\/a><\/p>\n<p>You have to move it to your powershell modules directory and then import-module<\/p>\n<pre lang=\"POWERSHELL\">##################################\r\n# Ed Rockwell\r\n# Requires SSH Module from here:\r\n# http:\/\/www.powershelladmin.com\/wiki\/SSH_from_PowerShell_using_the_SSH.NET_library\r\n# When downloading the above, you need to right click the download and unblock it in the properties\r\n# Then add the contents to your powershell modules\r\n# Free to distribute! Keep: http:\/\/www.EdRockwell.com\r\n# 5\/15\/2014\r\n\r\nImport-Module SSH-Sessions\r\n\r\n$FileServerLocation = '\\\\path\\to\\file\\server\\'\r\n$DeviceList = Get-Content '\\\\path\\to\\text\\file\\of\\devices\\NetworkDeviceList.txt'\r\n$Date = (Get-Date -f yyyyMMdd)\r\n\r\nmd $Date\r\ncd $Date\r\n\r\nforeach ($Device in $DeviceList)\r\n{\r\nNew-SSHSession -ComputerName $Device -Username YourCiscoUser -Password Password4CiscoUser\r\n$DeviceBackup = Invoke-SshCommand -ComputerName $Device -Command 'show start'\r\n$DeviceBackup | out-file $device'.txt'\r\n}\r\n\r\ncd ..\r\nMove-Item $Date $FileServerLocation<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Today, I was asked to write a script to connect to all our Cisco devices and backup the configs to our fileserver. After a few hours of figuring it out, this is what I came up with You ONLY need a READ ONLY account on the Cisco devices. We run this every day at 2:00 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[53,16,8],"tags":[54,55,21],"class_list":["post-104","post","type-post","status-publish","format-standard","hentry","category-cisco","category-powershell","category-scripting","tag-backup","tag-cisco-2","tag-powershell-2"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 4.9.9 - aioseo.com -->\n\t<meta name=\"description\" content=\"Today, I was asked to write a script to connect to all our Cisco devices and backup the configs to our fileserver. After a few hours of figuring it out, this is what I came up with You ONLY need a READ ONLY account on the Cisco devices. We run this every day at 2:00\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Ed Rockwell\"\/>\n\t<meta name=\"keywords\" content=\"backup,cisco,powershell\" \/>\n\t<link rel=\"canonical\" href=\"https:\/\/www.edrockwell.com\/blog\/ssh-powershell-backup-cisco-devices-script\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 4.9.9\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"System Admin [RESOLVED] | How To: Make My DevOps Life Easier\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"SSH with Powershell: Backup multiple Cisco devices | System Admin [RESOLVED]\" \/>\n\t\t<meta property=\"og:description\" content=\"Today, I was asked to write a script to connect to all our Cisco devices and backup the configs to our fileserver. After a few hours of figuring it out, this is what I came up with You ONLY need a READ ONLY account on the Cisco devices. We run this every day at 2:00\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/www.edrockwell.com\/blog\/ssh-powershell-backup-cisco-devices-script\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2014-05-15T21:35:25+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2026-07-02T16:57:33+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:title\" content=\"SSH with Powershell: Backup multiple Cisco devices | System Admin [RESOLVED]\" \/>\n\t\t<meta name=\"twitter:description\" content=\"Today, I was asked to write a script to connect to all our Cisco devices and backup the configs to our fileserver. After a few hours of figuring it out, this is what I came up with You ONLY need a READ ONLY account on the Cisco devices. We run this every day at 2:00\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.edrockwell.com\\\/blog\\\/ssh-powershell-backup-cisco-devices-script\\\/#article\",\"name\":\"SSH with Powershell: Backup multiple Cisco devices | System Admin [RESOLVED]\",\"headline\":\"SSH with Powershell: Backup multiple Cisco devices\",\"author\":{\"@id\":\"https:\\\/\\\/www.edrockwell.com\\\/blog\\\/author\\\/admin\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/www.edrockwell.com\\\/blog\\\/#organization\"},\"datePublished\":\"2014-05-15T21:35:25+00:00\",\"dateModified\":\"2026-07-02T16:57:33+00:00\",\"inLanguage\":\"en-US\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.edrockwell.com\\\/blog\\\/ssh-powershell-backup-cisco-devices-script\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.edrockwell.com\\\/blog\\\/ssh-powershell-backup-cisco-devices-script\\\/#webpage\"},\"articleSection\":\"Cisco, PowerShell, scripting, backup, cisco, Powershell\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.edrockwell.com\\\/blog\\\/ssh-powershell-backup-cisco-devices-script\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.edrockwell.com\\\/blog#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.edrockwell.com\\\/blog\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.edrockwell.com\\\/blog\\\/category\\\/scripting\\\/#listItem\",\"name\":\"scripting\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.edrockwell.com\\\/blog\\\/category\\\/scripting\\\/#listItem\",\"position\":2,\"name\":\"scripting\",\"item\":\"https:\\\/\\\/www.edrockwell.com\\\/blog\\\/category\\\/scripting\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.edrockwell.com\\\/blog\\\/ssh-powershell-backup-cisco-devices-script\\\/#listItem\",\"name\":\"SSH with Powershell: Backup multiple Cisco devices\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.edrockwell.com\\\/blog#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.edrockwell.com\\\/blog\\\/ssh-powershell-backup-cisco-devices-script\\\/#listItem\",\"position\":3,\"name\":\"SSH with Powershell: Backup multiple Cisco devices\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.edrockwell.com\\\/blog\\\/category\\\/scripting\\\/#listItem\",\"name\":\"scripting\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.edrockwell.com\\\/blog\\\/#organization\",\"name\":\"System Admin [RESOLVED]\",\"description\":\"How To: Make My DevOps Life Easier\",\"url\":\"https:\\\/\\\/www.edrockwell.com\\\/blog\\\/\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.edrockwell.com\\\/blog\\\/author\\\/admin\\\/#author\",\"url\":\"https:\\\/\\\/www.edrockwell.com\\\/blog\\\/author\\\/admin\\\/\",\"name\":\"Ed Rockwell\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/www.edrockwell.com\\\/blog\\\/ssh-powershell-backup-cisco-devices-script\\\/#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/dea3152d7acd78aa28d280207c33f7ec516731ece9a54249cbbbebcfffc341e0?s=96&d=mm&r=g\",\"width\":96,\"height\":96,\"caption\":\"Ed Rockwell\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.edrockwell.com\\\/blog\\\/ssh-powershell-backup-cisco-devices-script\\\/#webpage\",\"url\":\"https:\\\/\\\/www.edrockwell.com\\\/blog\\\/ssh-powershell-backup-cisco-devices-script\\\/\",\"name\":\"SSH with Powershell: Backup multiple Cisco devices | System Admin [RESOLVED]\",\"description\":\"Today, I was asked to write a script to connect to all our Cisco devices and backup the configs to our fileserver. After a few hours of figuring it out, this is what I came up with You ONLY need a READ ONLY account on the Cisco devices. We run this every day at 2:00\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.edrockwell.com\\\/blog\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.edrockwell.com\\\/blog\\\/ssh-powershell-backup-cisco-devices-script\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/www.edrockwell.com\\\/blog\\\/author\\\/admin\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/www.edrockwell.com\\\/blog\\\/author\\\/admin\\\/#author\"},\"datePublished\":\"2014-05-15T21:35:25+00:00\",\"dateModified\":\"2026-07-02T16:57:33+00:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.edrockwell.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.edrockwell.com\\\/blog\\\/\",\"name\":\"System Admin [RESOLVED]\",\"description\":\"How To: Make My DevOps Life Easier\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.edrockwell.com\\\/blog\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"SSH with Powershell: Backup multiple Cisco devices | System Admin [RESOLVED]","description":"Today, I was asked to write a script to connect to all our Cisco devices and backup the configs to our fileserver. After a few hours of figuring it out, this is what I came up with You ONLY need a READ ONLY account on the Cisco devices. We run this every day at 2:00","canonical_url":"https:\/\/www.edrockwell.com\/blog\/ssh-powershell-backup-cisco-devices-script\/","robots":"max-image-preview:large","keywords":"backup,cisco,powershell","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.edrockwell.com\/blog\/ssh-powershell-backup-cisco-devices-script\/#article","name":"SSH with Powershell: Backup multiple Cisco devices | System Admin [RESOLVED]","headline":"SSH with Powershell: Backup multiple Cisco devices","author":{"@id":"https:\/\/www.edrockwell.com\/blog\/author\/admin\/#author"},"publisher":{"@id":"https:\/\/www.edrockwell.com\/blog\/#organization"},"datePublished":"2014-05-15T21:35:25+00:00","dateModified":"2026-07-02T16:57:33+00:00","inLanguage":"en-US","mainEntityOfPage":{"@id":"https:\/\/www.edrockwell.com\/blog\/ssh-powershell-backup-cisco-devices-script\/#webpage"},"isPartOf":{"@id":"https:\/\/www.edrockwell.com\/blog\/ssh-powershell-backup-cisco-devices-script\/#webpage"},"articleSection":"Cisco, PowerShell, scripting, backup, cisco, Powershell"},{"@type":"BreadcrumbList","@id":"https:\/\/www.edrockwell.com\/blog\/ssh-powershell-backup-cisco-devices-script\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/www.edrockwell.com\/blog#listItem","position":1,"name":"Home","item":"https:\/\/www.edrockwell.com\/blog","nextItem":{"@type":"ListItem","@id":"https:\/\/www.edrockwell.com\/blog\/category\/scripting\/#listItem","name":"scripting"}},{"@type":"ListItem","@id":"https:\/\/www.edrockwell.com\/blog\/category\/scripting\/#listItem","position":2,"name":"scripting","item":"https:\/\/www.edrockwell.com\/blog\/category\/scripting\/","nextItem":{"@type":"ListItem","@id":"https:\/\/www.edrockwell.com\/blog\/ssh-powershell-backup-cisco-devices-script\/#listItem","name":"SSH with Powershell: Backup multiple Cisco devices"},"previousItem":{"@type":"ListItem","@id":"https:\/\/www.edrockwell.com\/blog#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/www.edrockwell.com\/blog\/ssh-powershell-backup-cisco-devices-script\/#listItem","position":3,"name":"SSH with Powershell: Backup multiple Cisco devices","previousItem":{"@type":"ListItem","@id":"https:\/\/www.edrockwell.com\/blog\/category\/scripting\/#listItem","name":"scripting"}}]},{"@type":"Organization","@id":"https:\/\/www.edrockwell.com\/blog\/#organization","name":"System Admin [RESOLVED]","description":"How To: Make My DevOps Life Easier","url":"https:\/\/www.edrockwell.com\/blog\/"},{"@type":"Person","@id":"https:\/\/www.edrockwell.com\/blog\/author\/admin\/#author","url":"https:\/\/www.edrockwell.com\/blog\/author\/admin\/","name":"Ed Rockwell","image":{"@type":"ImageObject","@id":"https:\/\/www.edrockwell.com\/blog\/ssh-powershell-backup-cisco-devices-script\/#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/dea3152d7acd78aa28d280207c33f7ec516731ece9a54249cbbbebcfffc341e0?s=96&d=mm&r=g","width":96,"height":96,"caption":"Ed Rockwell"}},{"@type":"WebPage","@id":"https:\/\/www.edrockwell.com\/blog\/ssh-powershell-backup-cisco-devices-script\/#webpage","url":"https:\/\/www.edrockwell.com\/blog\/ssh-powershell-backup-cisco-devices-script\/","name":"SSH with Powershell: Backup multiple Cisco devices | System Admin [RESOLVED]","description":"Today, I was asked to write a script to connect to all our Cisco devices and backup the configs to our fileserver. After a few hours of figuring it out, this is what I came up with You ONLY need a READ ONLY account on the Cisco devices. We run this every day at 2:00","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/www.edrockwell.com\/blog\/#website"},"breadcrumb":{"@id":"https:\/\/www.edrockwell.com\/blog\/ssh-powershell-backup-cisco-devices-script\/#breadcrumblist"},"author":{"@id":"https:\/\/www.edrockwell.com\/blog\/author\/admin\/#author"},"creator":{"@id":"https:\/\/www.edrockwell.com\/blog\/author\/admin\/#author"},"datePublished":"2014-05-15T21:35:25+00:00","dateModified":"2026-07-02T16:57:33+00:00"},{"@type":"WebSite","@id":"https:\/\/www.edrockwell.com\/blog\/#website","url":"https:\/\/www.edrockwell.com\/blog\/","name":"System Admin [RESOLVED]","description":"How To: Make My DevOps Life Easier","inLanguage":"en-US","publisher":{"@id":"https:\/\/www.edrockwell.com\/blog\/#organization"}}]},"og:locale":"en_US","og:site_name":"System Admin [RESOLVED] | How To: Make My DevOps Life Easier","og:type":"article","og:title":"SSH with Powershell: Backup multiple Cisco devices | System Admin [RESOLVED]","og:description":"Today, I was asked to write a script to connect to all our Cisco devices and backup the configs to our fileserver. After a few hours of figuring it out, this is what I came up with You ONLY need a READ ONLY account on the Cisco devices. We run this every day at 2:00","og:url":"https:\/\/www.edrockwell.com\/blog\/ssh-powershell-backup-cisco-devices-script\/","article:published_time":"2014-05-15T21:35:25+00:00","article:modified_time":"2026-07-02T16:57:33+00:00","twitter:card":"summary","twitter:title":"SSH with Powershell: Backup multiple Cisco devices | System Admin [RESOLVED]","twitter:description":"Today, I was asked to write a script to connect to all our Cisco devices and backup the configs to our fileserver. After a few hours of figuring it out, this is what I came up with You ONLY need a READ ONLY account on the Cisco devices. We run this every day at 2:00"},"aioseo_meta_data":{"post_id":"104","title":null,"description":null,"keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"Article","isEnabled":true},"graphs":[]},"schema_type":null,"schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"location":null,"local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"ai":null,"created":"2021-03-15 23:07:13","updated":"2026-07-02 17:26:23","seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.edrockwell.com\/blog\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.edrockwell.com\/blog\/category\/scripting\/\" title=\"scripting\">scripting<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tSSH with Powershell: Backup multiple Cisco devices\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/www.edrockwell.com\/blog"},{"label":"scripting","link":"https:\/\/www.edrockwell.com\/blog\/category\/scripting\/"},{"label":"SSH with Powershell: Backup multiple Cisco devices","link":"https:\/\/www.edrockwell.com\/blog\/ssh-powershell-backup-cisco-devices-script\/"}],"_links":{"self":[{"href":"https:\/\/www.edrockwell.com\/blog\/wp-json\/wp\/v2\/posts\/104","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.edrockwell.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.edrockwell.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.edrockwell.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.edrockwell.com\/blog\/wp-json\/wp\/v2\/comments?post=104"}],"version-history":[{"count":6,"href":"https:\/\/www.edrockwell.com\/blog\/wp-json\/wp\/v2\/posts\/104\/revisions"}],"predecessor-version":[{"id":112,"href":"https:\/\/www.edrockwell.com\/blog\/wp-json\/wp\/v2\/posts\/104\/revisions\/112"}],"wp:attachment":[{"href":"https:\/\/www.edrockwell.com\/blog\/wp-json\/wp\/v2\/media?parent=104"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.edrockwell.com\/blog\/wp-json\/wp\/v2\/categories?post=104"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.edrockwell.com\/blog\/wp-json\/wp\/v2\/tags?post=104"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}