- Community Home
- >
- Storage
- >
- HPE Nimble Storage
- >
- HPE Nimble Storage Solution Specialists
- >
- Re: Script to find NSs Snapshots
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-15-2020 11:48 AM
05-15-2020 11:48 AM
Script to find NSs Snapshots
Hey Everyone, I thought I'd share my script to automate the discovery and email the System Snapshots created by expanding a volume.
Create a service account, log into the machien were you want the password to reside and run the script from. Then create the encrypted password with this command:
Read-Host "PASSHERE" -AsSecureString | ConvertFrom-SecureString | Out-File "C:\location\to\pass.txt"
The password file can only be unencrypted with the service account, so make the scheduled task to run as that user.
#loads encrypted password
$securePass = Get-Content C:\location\to\pass.txt
#Decrypts password
$pass = $securePass | ConvertTo-SecureString
$Ptr = [System.Runtime.InteropServices.Marshal]::SecureStringToCoTaskMemUnicode($pass)
$decrypted = [System.Runtime.InteropServices.Marshal]::PtrToStringUni($Ptr)
[System.Runtime.InteropServices.Marshal]::ZeroFreeCoTaskMemUnicode($Ptr)
#Email parrameterss.
$EmailFrom = “emailfrom@address.com”
$EmailTo = “emailt@address.com”
$Subject = “NSs Snapshots”
$SMTPServer = “smtp.address.com”
#Plink command that gets the snaps
$Body1 = plink -ssh IPADDRESS -batch -l LOCALNIMBLEUSER -pw $decrypted "snap --list --all | grep NSs"
$Body2 = plink -ssh IPADDRESS -batch -l LOCALNIMBLEUSER -pw $decrypted "snap --list --all | grep NSs"
#Sends email
Send-MailMessage -from $EmailFrom -to $EmailTo -subject $Subject -smtpserver $SMTPServer -body @"
SAN1 Snapshots
$Body1
SAN2 Snapshots
$Body2
"@
#Variable Cleanup
$securePass = 1234
$pass = 1234
$Ptr = 1234
$decrypted = 1234
$Body1=1234
$Body2=1234
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-27-2020 11:55 PM
05-27-2020 11:55 PM
Re: Script to find NSs Snapshots
Hi Ryan
I would recommend our official toolkit (https://www.powershellgallery.com/packages/HPENimblePowerShellToolkit/3.0.0)But the method posted above looks ok too.
Hope this helps.!
Regards
Mahesh202
I work for HPE.
[Any personal opinions expressed are mine, and not official statements on behalf of Hewlett Packard Enterprise]