Commit 5906bc92 authored by Lonlone Lee's avatar Lonlone Lee

Fixed Syntax Errors

parent e4e0f7f1
......@@ -3,7 +3,7 @@ Set-PowerCLIConfiguration -Scope User -ParticipateInCEIP $true
Connect-VIServer -Server asvcprd03.stanford.edu
Get-VM | Get-Snapshot | Select vm,name,description,created,sizegb | Export-Csv -Path C:\temp\GetSnapshots.csv -NoTypeInformation -UseCulture
Get-VM | Get-Snapshot | Select-Object vm,name,description,created,sizegb | Export-Csv -Path C:\temp\GetSnapshots.csv -NoTypeInformation -UseCulture
Disconnect-VIServer -Server asvcprd03.stanford.edu -Confirm:$false
Start-Sleep -s 60
\ No newline at end of file
......@@ -4,16 +4,13 @@
###############
# These are the values you should get from your webform
#
$snapMemory = $false
$snapQuiesce = $true
$emailAddr = 'postgrads-sysadm@lists.stanford.edu'
$fileName = 'C:\Temp\GetSnapshots.csv'
$vcName = 'pgvcenter.stanford.edu'
###############
Connect-VIServer -Server $vcName
Import-Csv -Path $fileName -UseCulture | %{
Import-Csv -Path $fileName -UseCulture | ForEach-Object {
$VMName = $_.VM
$snapName = $_.Name
......
......@@ -3,7 +3,7 @@ Set-PowerCLIConfiguration -Scope User -ParticipateInCEIP $true
Connect-VIServer -Server pgvcenter.stanford.edu
Get-VM | Select Name,VMHost,PowerState | where { $_.PowerState -eq "PoweredOn" } | Export-Csv -Path C:\temp\PoweredOnVMsAndHosts.csv -NoTypeInformation -UseCulture
Get-VM | Select-Object Name,VMHost,PowerState | Where-Object { $_.PowerState -eq "PoweredOn" } | Export-Csv -Path C:\temp\PoweredOnVMsAndHosts.csv -NoTypeInformation -UseCulture
Disconnect-VIServer -Server pgvcenter.stanford.edu -Confirm:$false
Start-Sleep -s 60
\ No newline at end of file
......@@ -3,7 +3,7 @@ Set-PowerCLIConfiguration -Scope User -ParticipateInCEIP $true
Connect-VIServer -Server pgvcenter.stanford.edu
Get-VM | Select Name,ProvisionedSpaceGB,UsedSpaceGB,NumCPU,CoresPerSocket,MemoryMB,Version,VMHost,PowerState | where { $_.PowerState -eq "PoweredOn" } | Export-Csv -Path C:\temp\PoweredOnVMSpecs.csv -NoTypeInformation -UseCulture
Get-VM | Select-Object Name,ProvisionedSpaceGB,UsedSpaceGB,NumCPU,CoresPerSocket,MemoryMB,Version,VMHost,PowerState | Where-Object { $_.PowerState -eq "PoweredOn" } | Export-Csv -Path C:\temp\PoweredOnVMSpecs.csv -NoTypeInformation -UseCulture
Disconnect-VIServer -Server pgvcenter.stanford.edu -Confirm:$false
Start-Sleep -s 60
\ No newline at end of file
......@@ -4,10 +4,10 @@ Set-PowerCLIConfiguration -Scope User -ParticipateInCEIP $true
Connect-VIServer -Server pgvcenter.stanford.edu
Get-VM | Select Name,PowerState,
Get-VM | Select-Object Name,PowerState,
@{N="Tools Installed";E={$_.Guest.ToolsVersion -ne ""}},
@{N="Tools Status";E={$_.ExtensionData.Guest.ToolsStatus}},
@{N="Tools version";E={if($_.Guest.ToolsVersion -ne ""){$_.Guest.ToolsVersion}}} | where { $_.PowerState -eq "PoweredOn" } | Export-Csv -Path C:\temp\VMWareToolsStatus.csv -NoTypeInformation -UseCulture
@{N="Tools version";E={if($_.Guest.ToolsVersion -ne ""){$_.Guest.ToolsVersion}}} | Where-Object { $_.PowerState -eq "PoweredOn" } | Export-Csv -Path C:\temp\VMWareToolsStatus.csv -NoTypeInformation -UseCulture
Disconnect-VIServer -Server pgvcenter.stanford.edu -Confirm:$false
Start-Sleep -s 60
\ No newline at end of file
......@@ -4,7 +4,7 @@
Connect-VIServer -Server pgvcenter.stanford.edu
#(Get-View ScheduledTaskManager).ScheduledTask | %{ (Get-View $_).Info } | Export-Csv -Path C:\temp\GetScheduledTasks.csv -NoTypeInformation -UseCulture
(Get-View ScheduledTaskManager).ScheduledTask | %{ (Get-View $_).Info } | Select Name,Description,TaskObject,Enabled,State,NextRunTime | Export-Csv -Path C:\temp\GetScheduledTasks.csv -NoTypeInformation -UseCulture
(Get-View ScheduledTaskManager).ScheduledTask | ForEach-Object { (Get-View $_).Info } | Select-Object Name,Description,TaskObject,Enabled,State,NextRunTime | Export-Csv -Path C:\temp\GetScheduledTasks.csv -NoTypeInformation -UseCulture
Disconnect-VIServer -Server pgvcenter.stanford.edu -Confirm:$false
Start-Sleep -s 60
......@@ -3,7 +3,7 @@ Set-PowerCLIConfiguration -Scope User -ParticipateInCEIP $true
Connect-VIServer -Server pgvcenter.stanford.edu
$task = ((Get-View ScheduledTaskManager).ScheduledTask | %{ (Get-View $_).Info } | Where-Object {$_.Description -eq "Winter 2019 Patching"})
$task = ((Get-View ScheduledTaskManager).ScheduledTask | ForEach-Object { (Get-View $_).Info } | Where-Object {$_.Description -eq "Winter 2019 Patching"})
$task.RemoveScheduledTask
Disconnect-VIServer -Server pgvcenter.stanford.edu -Confirm:$false
......
......@@ -13,7 +13,7 @@ $vcName = 'pgvcenter.stanford.edu'
Connect-VIServer -Server $vcName
Import-Csv -Path $fileName -UseCulture | %{
Import-Csv -Path $fileName -UseCulture | ForEach-Object {
$dateString = $_.SnapDateTime
$snapTime = Get-Date $dateString
......@@ -41,7 +41,7 @@ Import-Csv -Path $fileName -UseCulture | %{
$spec.Action = New-Object VMware.Vim.MethodAction
$spec.Action.Name = "CreateSnapshot_Task"
@($snapName,$snapDescription,$snapMemory,$snapQuiesce) | %{
@($snapName,$snapDescription,$snapMemory,$snapQuiesce) | ForEach-Object {
$arg = New-Object VMware.Vim.MethodActionArgument
$arg.Value = $_
$spec.Action.Argument += $arg
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment