Reply to Message

View discussion in a popup

Replying to:
pedro2022
Contributor
Contributor

I get the following error when I run the command from powershell:

virtualMwsnapshots.ps1:1 char:50

+ $myVMs = Get-VM $VMsWithSnaps = @() foreach ($vm in $myVMs) {     $vm ...

+                                                  ~~

Unexpected token 'in' in expression or statement.

At C:\users\*******\desktop\virtualMwsnapshots.ps1:1 char:49

+ $myVMs = Get-VM $VMsWithSnaps = @() foreach ($vm in $myVMs) {     $vm ...

+                                                 ~

Missing closing ')' in expression.

At C:\users\********\desktop\virtualMwsnapshots.ps1:1 char:59

+ $myVMs = Get-VM $VMsWithSnaps = @() foreach ($vm in $myVMs) {     $vm ...

+                                                           ~

Unexpected token ')' in expression or statement.

At C:\users\*******\desktop\virtualMwsnapshots.ps1:1 char:408

+ ... y {         $user = $SnapshotEvents[0].UserName         $time = $Snap ...

+                                                             ~~~~~

Unexpected token '$time' in expression or statement.

At C:\users\*******\desktop\virtualMwsnapshots.ps1:1 char:541

+ ...            $user = $SnapshotEvents.UserName             $time = $Snap ...

+                                                             ~~~~~

Unexpected token '$time' in expression or statement.

At C:\users\******\desktop\virtualMwsnapshots.ps1:1 char:791

+ ...  $user         $VMsWithSnaps += $VMInfo     } } $VMsWithSnaps | Sort  ...

+                                                     ~~~~~~~~~~~~~

Unexpected token '$VMsWithSnaps' in expression or statement.

    + CategoryInfo          : ParserError: (:) [], ParseException

    + FullyQualifiedErrorId : UnexpectedToken

Reply
0 Kudos