Windows update 1

User avatar
daniel
Site Admin
Posts: 223
Joined: Tue Jan 09, 2007 9:54 pm
Contact:

Windows update 1

Postby daniel » Wed May 15, 2019 12:39 pm

##\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
##
## Filename:
## Author: HPE
##
## This script will export.....
##
##
## syntax:
##
## Prerquisites:
##
## Caution:
##
## History
## 0.1 draft
##
##\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

[cmdletbinding()]
param (

[parameter(ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true)]
[string[]]$ComputerName = $env:computername

)

## Load Powershel Snapin
#if ((Get-PSSnapin -Name "Quest.ActiveRoles.ADManagement" -ErrorAction SilentlyContinue) -eq $null) {
# Add-PsSnapin "Quest.ActiveRoles.ADManagement" }

## Load Active Directory powershell module
#Import-Module ActiveDirectory
Import-Module virtualmachinemanager

## Define files with Computer information
$fullPathIncFileName = $MyInvocation.MyCommand.Definition
$currentScriptName = $MyInvocation.MyCommand.Name
$currentExecutingPath = $fullPathIncFileName.Replace($currentScriptName, "")
$csvSource=$currentScriptName.trimend("ps1")+"csv"
$csvSav=$currentScriptName.trimend("ps1")+"-sav.csv"
$csvDest=$currentScriptName.trimend("ps1")+"-Out.csv"
$LogFile = $currentScriptName.trimend("ps1")+"log"
$reports = @()
$Delimiter="`t"



$Reports = @()
write-host ""
write-host "Cluster;OwnerNode;Name;GroupType;State"
foreach ($Computer in $ComputerName) {

$Objs=Get-ClusterGroup -Cluster "$Computer" | where-object GroupType -like "VirtualMachine"

#$Objs=Get-ClusterResource -Cluster "$Computer" | Where-Object { $_.resourcetype -eq 'virtual machine'} | get-VM

foreach ($Obj in $Objs) {
write-host $Obj.Cluster";"$Obj.OwnerNode";"$Obj.Name";"$Obj.GroupType";"$Obj.State
$Report = New-Object System.Object
$Report | Add-Member NoteProperty -Name "Cluster" -Value $Obj.Cluster
$Report | Add-Member NoteProperty -Name "OwnerNode" -Value $Obj.OwnerNode
$Report | Add-Member NoteProperty -Name "Name" -Value $Obj.Name
$Report | Add-Member NoteProperty -Name "GroupType" -Value $Obj.GroupType
$Report | Add-Member NoteProperty -Name "State" -Value $Obj.State
$reports += $report
}


}
$reports | export-csv -Path $csvDest -NoTypeInformation -delimiter $Delimiter -Encoding unicode
write-host ""
$reports | Out-GridView
#notepad .\$csvDest
#Write-Host "Press any key to continue ..."
#$x = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")

Return to “PowerShell”

Who is online

Users browsing this forum: No registered users and 1 guest