Add your feed to SetSticker.com! Promote your sites and attract more customers. It costs only 100 EUROS per YEAR.

Title


Description

TAG 15/20


Your domain [ rss | feed ]


Pleasant surprises on every page! Discover new articles, displayed randomly throughout the site. Interesting content, always a click away


Warning: Undefined variable $pay in /home/setstick/public_html/read.php on line 299

Warning: Undefined variable $pay in /home/setstick/public_html/read.php on line 330

Total Number of CPUs and Memory across all VM hosts 9 Feb 2024, 11:26 am

param(
    [string]$vCenterServer = "vcenter.vcapsie.corp",
    [string]$outputLocation = "C:\vcapsie"
)

# Function to log messages
function Write-Log {
    param(
        [string]$Message,
        [string]$Path
    )
    $timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
    "${timestamp}: $Message" | Out-File -FilePath $Path -Append
}

# Credentials
$credentials = Get-Credential

# Log file preparation
$logFile = Join-Path -Path $outputLocation -ChildPath "ScriptLog.txt"

# Connect to vCenter
try {
    Connect-VIServer $vCenterServer -Credential $credentials -AllLinked
    Write-Log -Message "Connected to vCenter server: $vCenterServer" -Path $logFile
} catch {
    Write-Log -Message "Error connecting to vCenter: $_" -Path $logFile
    return
}

# Current date and filename preparation
$date = Get-Date -Format "yyyyMMddHHmm"
$filename = "$date-VMHostInfo.csv"
$path = Join-Path -Path $outputLocation -ChildPath $filename

# Ensure directory existence
if (-not (Test-Path -Path $outputLocation)) {
    New-Item -ItemType Directory -Path $outputLocation
    Write-Log -Message "Directory created at: $outputLocation" -Path $logFile
}

# Retrieve and process VM hosts information
$vmHosts = Get-VMHost
$cpuTotal = ($vmHosts | Measure-Object -Property NumCpu -Sum).Sum
$memTotal = ($vmHosts | Measure-Object -Property MemoryTotalGB -Sum).Sum

Write-Host "Total Number of CPUs across all VM hosts: $cpuTotal"
Write-Host "Total amount of Memory across all VM hosts: $($memTotal -as [int])"
Write-Log -Message "Total CPUs: $cpuTotal, Total Memory: $memTotal GB" -Path $logFile

$vmHostsInfo = $vmHosts | Select-Object Name, @{Name="Parent";Expression={$_.Parent}}, NumCpu, @{Name="MemoryGB";Expression={$_.MemoryTotalGB -as [int]}}
$vmHostsInfo | Export-Csv -Path $path -NoTypeInformation
Write-Host "VM hosts information exported to CSV file at: $path"
Write-Log -Message "VM hosts information exported to CSV file at: $path" -Path $logFile

# Disconnect from the vCenter Server
try {
    Disconnect-VIServer * -Confirm:$false
    Write-Log -Message "Disconnected from vCenter server" -Path $logFile
} catch {
    Write-Log -Message "Error disconnecting from vCenter: $_" -Path $logFile
}

Generate complex passwords 2 Feb 2024, 8:54 am

function Generate-ComplexPassword {
param(
[Parameter(Mandatory=$true)]
[int]$Length
)

# Define character sets
$lowercase = "abcdefghijklmnopqrstuvwxyz"
$uppercase = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
$numbers = "0123456789"
$specialChars = "!@#$%^&*()_-+=[]{}|;:,.<>/?"
$allChars = $lowercase + $uppercase + $numbers + $specialChars

# Ensure password length is at least 15 characters
if ($Length -lt 15) {
Write-Error "Password length must be at least 15 characters."
return
}

# Generate initial password with at least one character from each set
$password = @(
Get-Random -InputObject $lowercase.ToCharArray()
Get-Random -InputObject $uppercase.ToCharArray()
Get-Random -InputObject $numbers.ToCharArray()
Get-Random -InputObject $specialChars.ToCharArray()
)

# Fill the rest of the password to the desired length
for ($i = $password.Count; $i -lt $Length; $i++) {
$password += Get-Random -InputObject $allChars.ToCharArray()
}

# Shuffle the password to avoid predictable patterns
$password = $password | Get-Random -Count $password.Count

# Output the password as a single string
-join $password
}

# Example usage:
# Generate-ComplexPassword -Length 15


Above code allows you to generate complex passwords from within PowerShell. Load the function into powershell and start generating passwords:

Check for THIN disks in your VMware environment 12 Jan 2024, 6:09 am

# PowerShell Script to Check VM Hard Disk Types and Export Results

# Fetch all VMs
$vms = Get-VM

# Initialize variables
$totalVMs = $vms.Count
$completedVMs = 0

# Create an empty array to store results
$results = @()

# Process each VM
foreach ($vm in $vms) {
    # Get hard disks of the current VM
    $hardDisks = Get-HardDisk -VM $vm

    # Filter for thin disks and add results to the array
    $filteredDisks = $hardDisks | Where-Object { $_.DiskType -eq "thin" } | Select-Object @{Name="VMName"; Expression={$vm.Name}}, Name, DiskType
    $results += $filteredDisks

    # Update completed VM count
    $completedVMs++

    # Calculate and show progress
    $progress = [math]::Round(($completedVMs / $totalVMs) * 100, 2)
    Write-Progress -Activity "Checking VM Hard Disks" -Status "$vm.Name ($progress% completed)" -PercentComplete $progress
}

# Export results to CSV
$results | Export-Csv C:\Users\vcapsie\Desktop\thindisks.csv -NoTypeInformation

Page processed in 1.045 seconds.

Loading Offers..
Home Privacy Policy


Warning: Undefined variable $id in /home/setstick/public_html/read.php on line 516

Warning: Undefined variable $ttt in /home/setstick/public_html/read.php on line 516

Warning: Undefined variable $linkd in /home/setstick/public_html/read.php on line 516

Fatal error: Uncaught mysqli_sql_exception: Duplicate entry '/read.php?feed=https%3A%2F%2Fvcapsie.com%2Ffeed%2F' for key 'vin' in /home/setstick/public_html/read.php:518 Stack trace: #0 /home/setstick/public_html/read.php(518): mysqli->query() #1 {main} thrown in /home/setstick/public_html/read.php on line 518