NEW: Some new scripts
This commit is contained in:
@@ -0,0 +1,28 @@
|
|||||||
|
const https = require('https');
|
||||||
|
|
||||||
|
const options = {
|
||||||
|
hostname: 'blog.headdesk.me',
|
||||||
|
port: 443,
|
||||||
|
path: '/',
|
||||||
|
method: 'GET'
|
||||||
|
};
|
||||||
|
|
||||||
|
const req = https.request(options, (res) => {
|
||||||
|
console.log('Status Code:', res.statusCode);
|
||||||
|
console.log('Response Headers:', res.headers);
|
||||||
|
|
||||||
|
res.on('data', (chunk) => {
|
||||||
|
// Consume response data if needed
|
||||||
|
});
|
||||||
|
|
||||||
|
res.on('end', () => {
|
||||||
|
console.log('Response ended.');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
req.on('error', (e) => {
|
||||||
|
console.error(`Problem with request: ${e.message}`);
|
||||||
|
});
|
||||||
|
|
||||||
|
req.end();
|
||||||
|
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0
|
||||||
|
Start-Service sshd
|
||||||
|
Set-Service -Name sshd -StartupType 'Automatic'
|
||||||
|
New-NetFirewallRule -Name "SSH" -DisplayName "OpenSSH Server" -Enabled True -Direction Inbound -Protocol TCP -LocalPort 22 -Action Allow
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
Write-Output "Installing PSWindowsUpdate"
|
||||||
|
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
||||||
|
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force
|
||||||
|
Install-Module PSWindowsUpdate -Force -Confirm:$False
|
||||||
|
|
||||||
|
Write-Output "Running Get-WindowsUpdate"
|
||||||
|
Get-WindowsUpdate -MicrosoftUpdate -Category 'Critical Updates', 'Security Updates' -Verbose
|
||||||
|
|
||||||
|
Write-Output "Running Invoke-WUJob"
|
||||||
|
Invoke-WUJob -Script {ipmo PSWindowsUpdate;Get-WindowsUpdate -Install -MicrosoftUpdate -Category 'Critical Updates', 'Security Updates' -AcceptAll -IgnoreReboot -Verbose | Out-File C:\WindowsUpdate.log} -RunNow -Confirm:$false
|
||||||
|
|
||||||
|
Write-Output "Get-ScheduledTask -TaskName PSWindowsUpdate"
|
||||||
|
Get-ScheduledTask -TaskName PSWindowsUpdate
|
||||||
|
|
||||||
|
Write-Output "(Get-ScheduledTask -TaskName PSWindowsUpdate).Actions"
|
||||||
|
(Get-ScheduledTask -TaskName PSWindowsUpdate).Actions
|
||||||
|
|
||||||
|
Write-Output "Get-ScheduledTaskInfo -TaskName PSWindowsUpdate"
|
||||||
|
Get-ScheduledTaskInfo -TaskName PSWindowsUpdate
|
||||||
|
|
||||||
|
Write-Output "Get-Content C:\WindowsUpdate.log"
|
||||||
|
Get-Content "C:\WindowsUpdate.log"
|
||||||
|
|
||||||
|
Write-Output "Waiting for PSWindowsUpdate Task to Complete"
|
||||||
|
$stopWatch = [System.Diagnostics.Stopwatch]::StartNew()
|
||||||
|
while($true) {
|
||||||
|
$taskStatus = (Get-ScheduledTask -TaskName PSWindowsUpdate).State
|
||||||
|
Write-Output "PSWindowsUpdate Task Status - $taskStatus"
|
||||||
|
|
||||||
|
if ($taskStatus -ne "Ready" ) {
|
||||||
|
$elapsed = "{0:D2}:{1:D2}:{2:D2}" -f $stopWatch.Elapsed.Hours, $stopWatch.Elapsed.Minutes, $stopWatch.Elapsed.Seconds
|
||||||
|
Write-Output "Waiting for completion of task PSWindowsUpdate - $elapsed"
|
||||||
|
Write-Output "Get-Content C:\WindowsUpdate.log"
|
||||||
|
Get-Content "C:\WindowsUpdate.log"
|
||||||
|
Start-Sleep -s 10
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Write-Output "PSWindowsUpdate Task Completed"
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Output "Get-Content C:\WindowsUpdate.log"
|
||||||
|
Get-Content "C:\WindowsUpdate.log"
|
||||||
|
$taskStatus = (Get-ScheduledTask -TaskName PSWindowsUpdate).State
|
||||||
|
Write-Output "PSWindowsUpdate Task Status - $taskStatus"
|
||||||
|
Write-Output "Get-WUHistory"
|
||||||
|
Get-WUHistory
|
||||||
|
|
||||||
|
|
||||||
Executable
+20
@@ -0,0 +1,20 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
function doit() {
|
||||||
|
echo $1 | ts
|
||||||
|
sleep 1
|
||||||
|
}
|
||||||
|
|
||||||
|
export -f doit
|
||||||
|
|
||||||
|
echo "* Regular loop execution"
|
||||||
|
for i in $(seq 1 5); do
|
||||||
|
doit $i
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "* Execution with sem"
|
||||||
|
for i in $(seq 1 5); do
|
||||||
|
sem -j4 doit $i
|
||||||
|
done
|
||||||
|
|
||||||
|
sem --wait
|
||||||
Reference in New Issue
Block a user