-
-
Save S3cur3Th1sSh1t/dc8bda3635190ff2c6353833437e1a5a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# PowerShell Fun Script | |
Write-Host "Starting the script..." | |
# Generate a random number | |
$random = New-Object System.Random | |
$randomNumber = $random.Next(1, 101) | |
Write-Host "Random number generated: $randomNumber" | |
# Get current date and format it | |
$currentDate = [System.DateTime]::Now.ToString("yyyy-MM-dd HH:mm:ss") | |
Write-Host "Current Date: $currentDate" | |
# Create an array of items and print them | |
$items = @("Apple", "Banana", "Cherry", "Date", "Elderberry") | |
Write-Host "Fruits List:" $items -join ", " | |
# Create a hashtable and manipulate values | |
$person = @{Name="John Doe"; Age=30; City="New York"} | |
$person["Occupation"] = "Software Engineer" | |
Write-Host "Person Info: Name=$($person['Name']), Age=$($person['Age']), City=$($person['City']), Job=$($person['Occupation'])" | |
# Loop through numbers and print even numbers | |
Write-Host "Even numbers from 1 to 10:" | |
for ($i = 1; $i -le 10; $i++) { | |
if ($i % 2 -eq 0) { | |
Write-Host $i | |
} | |
} | |
# Get a list of running processes and print top 5 | |
$processes = Get-Process | Sort-Object CPU -Descending | Select-Object -First 5 | |
Write-Host "Top 5 CPU consuming processes:" | |
$processes | ForEach-Object { Write-Host $_.ProcessName $_.CPU } | |
# Simple string "encryption" (just reversing) | |
Function Encrypt-Text($text) { | |
return -join ($text.ToCharArray() | Sort-Object {Get-Random}) | |
} | |
Function Decrypt-Text($text) { | |
return $text # This is just a placeholder (not real decryption) | |
} | |
$original = "HelloWorld" | |
$encrypted = Encrypt-Text $original | |
Write-Host "Original: $original" | |
Write-Host "Encrypted: $encrypted" | |
# Wait for user input before closing | |
Write-Host "Press any key to exit..." | |
$null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment