Commit e4e0f7f1 authored by Lonlone Lee's avatar Lonlone Lee

Supressed the Disconnect vCenter input and added a 60sec sleep at the end of each script

parent bb4daf98
Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -Confirm
#Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -Confirm
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
Disconnect-VIServer -Server asvcprd03.stanford.edu
\ No newline at end of file
Disconnect-VIServer -Server asvcprd03.stanford.edu -Confirm:$false
Start-Sleep -s 60
\ No newline at end of file
......@@ -29,4 +29,5 @@ Import-Csv -Path $fileName -UseCulture | %{
}
}
Disconnect-VIServer -Server $vcName
Disconnect-VIServer -Server $vcName -Confirm:$false
Start-Sleep -s 60
\ No newline at end of file
Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -Confirm
#Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -Confirm
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
Disconnect-VIServer -Server pgvcenter.stanford.edu
\ No newline at end of file
Disconnect-VIServer -Server pgvcenter.stanford.edu -Confirm:$false
Start-Sleep -s 60
\ No newline at end of file
Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -Confirm
#Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -Confirm
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
Disconnect-VIServer -Server pgvcenter.stanford.edu
\ No newline at end of file
Disconnect-VIServer -Server pgvcenter.stanford.edu -Confirm:$false
Start-Sleep -s 60
\ No newline at end of file
Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -Confirm
#Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -Confirm
Set-PowerCLIConfiguration -Scope User -ParticipateInCEIP $true
Connect-VIServer -Server pgvcenter.stanford.edu
......@@ -8,4 +9,5 @@ Get-VM | Select Name,PowerState,
@{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
Disconnect-VIServer -Server pgvcenter.stanford.edu
\ No newline at end of file
Disconnect-VIServer -Server pgvcenter.stanford.edu -Confirm:$false
Start-Sleep -s 60
\ No newline at end of file
......@@ -7,3 +7,4 @@ Connect-VIServer -Server pgvcenter.stanford.edu
(Get-View ScheduledTaskManager).ScheduledTask | %{ (Get-View $_).Info } | Select 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
Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -Confirm
#Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -Confirm
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.RemoveScheduledTask
Disconnect-VIServer -Server pgvcenter.stanford.edu
\ No newline at end of file
Disconnect-VIServer -Server pgvcenter.stanford.edu -Confirm:$false
Start-Sleep -s 60
\ No newline at end of file
#Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -Confirm
Set-PowerCLIConfiguration -Scope User -ParticipateInCEIP $true
###############
# These are the values you should get from your webform
......@@ -49,4 +50,5 @@ Import-Csv -Path $fileName -UseCulture | %{
$scheduledTaskManager.CreateObjectScheduledTask($vm.ExtensionData.MoRef, $spec)
}
Disconnect-VIServer -Server $vcName
Disconnect-VIServer -Server $vcName -Confirm:$false
Start-Sleep -s 60
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