• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 594
  • Last Modified:

PowerCLI 5 SnapShot Creation

I'm trying to write a powershell script to take a snapshot of select Vm's daily using Task Scheduler. For the name of the snapshot I would like the name to include the date. So I craeted a variable to looked something like this:

$Snapshotname ="Daily Snapsho (get-date)" the only this the vaible does is echo the word get-date.

What am i doing wrong..
  • 2
1 Solution
Andrew Hancock (VMware vExpert / EE MVE^2)VMware and Virtualization ConsultantCommented:
$Snapshotname = "Daily Snapshot " + (get-date)

will produce

Daily Snapshot 12/30/2011 20:47:43

compdigit44Author Commented:
so any time you need to call a cmdlet inside of a new variable you need to use he + sign and have the cmdlet in () correct?
Andrew Hancock (VMware vExpert / EE MVE^2)VMware and Virtualization ConsultantCommented:
Yes thats correct.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now