<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Script on Notities</title><link>https://19cc27e0.backup-website.pages.dev/tags/script/</link><description>Recent content in Script on Notities</description><generator>Hugo</generator><language>nl</language><lastBuildDate>Wed, 15 Jul 2026 23:50:02 +0200</lastBuildDate><atom:link href="https://19cc27e0.backup-website.pages.dev/tags/script/index.xml" rel="self" type="application/rss+xml"/><item><title>Zoek de naam van je USB stick met een script</title><link>https://19cc27e0.backup-website.pages.dev/blog/2024-zoek-de-naam-van-je-usb-stick-met-een-script/</link><pubDate>Thu, 18 Jul 2024 07:20:59 +0000</pubDate><guid>https://19cc27e0.backup-website.pages.dev/blog/2024-zoek-de-naam-van-je-usb-stick-met-een-script/</guid><description>&lt;p&gt;D﻿it script kun je gebruiken voor het opvragen van de naam van je USB stick.&lt;br&gt;
De naam van je USB stick kun je gebruiken in het sudo commando van Apple om een USB installer te maken.&lt;br&gt;
&lt;br&gt;
S﻿tap 1: Open de Terminal applicatie&lt;br&gt;
S﻿tap 2: Ga naar je home directory, type: # cd&lt;br&gt;
S﻿tap 3: Maak eventueel een directory scripts, type: # mkdir scripts&lt;br&gt;
S﻿tap 4: Ga naar de zojuist gemaakte scripts directory, type: # cd scripts&lt;br&gt;
Stap 5: Maak een bash script, type: # vim usbstick.sh&lt;br&gt;
Stap 6: Insert de volgende code:&lt;/p&gt;</description></item><item><title>Bash script met een SUCCES of FAILED melding aan het einde van de regel</title><link>https://19cc27e0.backup-website.pages.dev/blog/2024-bash-script-met-een-succes-of-failed-melding-aan-het-einde-van-de-regel/</link><pubDate>Wed, 31 Jan 2024 20:18:39 +0000</pubDate><guid>https://19cc27e0.backup-website.pages.dev/blog/2024-bash-script-met-een-succes-of-failed-melding-aan-het-einde-van-de-regel/</guid><description>&lt;p&gt;Z﻿ie hieronder een voorbeeld script om aan het einde van de regel helemaal rechts uitgelijnd een SUCCES melding in het groen of een FAILED melding in het rood te krijgen.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;#!/bin/bash

# Set the message
success_message=&amp;#34;Your command was successful&amp;#34;
failed_message=&amp;#34;Your command failed&amp;#34;

# Set the &amp;#34;OK&amp;#34; string in green
ok=&amp;#34;$(tput setaf 2)[SUCCES]$(tput sgr0)&amp;#34;
failed=&amp;#34;$(tput setaf 1)[FAILED]$(tput sgr0)&amp;#34;

# Get the width of the terminal
term_width=$(tput cols)+9

# Calculate the number of dots needed
success_dots_count=$((term_width - ${#success_message} - ${#ok}))
failed_dots_count=$((term_width - ${#failed_message} - ${#failed}))

# Create a string of dots for success and failed messages
success_dots=$(printf &amp;#34;%0.s.&amp;#34; $(seq 1 $success_dots_count))
failed_dots=$(printf &amp;#34;%0.s.&amp;#34; $(seq 1 $failed_dots_count))

# Print the success message with dots and &amp;#34;OK&amp;#34; at the end of the line
printf &amp;#34;%s%s%s\n&amp;#34; &amp;#34;$success_message &amp;#34; &amp;#34;$success_dots&amp;#34; &amp;#34; $ok&amp;#34;

# Print the failed message with dots and &amp;#34;FAILED&amp;#34; at the end of the line
printf &amp;#34;%s%s%s\n&amp;#34; &amp;#34;$failed_message &amp;#34; &amp;#34;$failed_dots&amp;#34; &amp;#34; $failed&amp;#34;
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>PowerShell computerresourcemonitor-script met cpu-percentage en uitgebreide geheugeninformatie</title><link>https://19cc27e0.backup-website.pages.dev/blog/2024-powershell-computer-resource-monitor-script-with-cpu-percentage-and-advanced-memory-information/</link><pubDate>Thu, 04 Jan 2024 22:21:38 +0000</pubDate><guid>https://19cc27e0.backup-website.pages.dev/blog/2024-powershell-computer-resource-monitor-script-with-cpu-percentage-and-advanced-memory-information/</guid><description>&lt;p&gt;PowerShell computerresourcemonitor-script met cpu-percentage en uitgebreide geheugeninformatie&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;PowerShell

Resourcemonitor


 $app=&amp;#34;notepad&amp;#34;
 $ids = Get-Process $app | Select-Object -Property Id | ForEach-Object {$_.Id}

 $filedate = Get-Date -format &amp;#34;yyyy-MM-dd&amp;#34;

 #echo $pids

 foreach ($id in $ids) {

 $date = Get-Date -format &amp;#34;yyyy-MM-dd HH:mm:ss&amp;#34;

 # CPU-informatie van het proces

 $ProcessId = $id
 $Process = Get-WmiObject -Query &amp;#34;SELECT * FROM Win32_PerfFormattedData_PerfProc_Process WHERE IDProcess = $ProcessId&amp;#34;
 $usage = $Process.PercentProcessorTime


 # Geheugeninformatie van het proces

 $TotalMemory = (Get-CimInstance Win32_ComputerSystem).TotalPhysicalMemory / 1GB

 $ProcessMem = Get-CIMInstance Win32_Process -Filter &amp;#34;ProcessId = &amp;#39;$id&amp;#39;&amp;#34;
 $MemSizeInKB = $ProcessMem.WS/1KB
 $PeakWorkingSetInKB = $Process.PeakWorkingSet/1KB
 $PageCountInKB = $ProcessMem.PrivatePageCount/1KB
 $NonPagedPoolInKB = $ProcessMem.QuotaNonPagedPoolUsage/1KB
 $PagedPoolInKB = $ProcessMem.QuotaPagedPoolUsage/1KB

 $TotalMemory = &amp;#34;{0:n3}&amp;#34; -f $TotalMemory
 $MemSizeInKB = &amp;#34;{0:n3}&amp;#34; -f $MemSizeInKB
 $PeakWorkingSetInKB = &amp;#34;{0:n3}&amp;#34; -f $PeakWorkingSetInKB
 $PageCountInKB = &amp;#34;{0:n3}&amp;#34; -f $PageCountInKB
 $NonPagedPoolInKB = &amp;#34;{0:n3}&amp;#34; -f $NonPagedPoolInKB
 $PagedPoolInKB = &amp;#34;{0:n3}&amp;#34; -f $PagedPoolInKB

 #write-host &amp;#34;$TotalMemory&amp;#34;
 #write-host &amp;#34;$MemSizeInKB&amp;#34;
 #write-host &amp;#34;$PeakWorkingSetInKB&amp;#34;
 #write-host &amp;#34;$PageCountInKB&amp;#34;
 #write-host &amp;#34;$NonPagedPoolInKB&amp;#34;
 #write-host &amp;#34;$PagedPoolInKB&amp;#34;

 # Opdrachtregel-informatie
 $commandline = (Get-CimInstance Win32_Process -Filter &amp;#34;ProcessId=$id&amp;#34;).CommandLine

 $FileName = $filedate+&amp;#34;_memory_usage.txt&amp;#34;
 $FullPath = Join-Path -Path &amp;#34;C:\Users\mvdbo\OneDrive\Documenten\PowerShell&amp;#34; -ChildPath $FileName

 $regel = &amp;#34;$date - pid: $id - cpu: $usage % - mem: $MemSizeInKB KB - pws: $PeakWorkingSetInKB KB - pc: $PageCountInKB KB - pp: $PagedPoolInKB KB - command: $commandline&amp;#34;
 $regel | Out-File -FilePath $FullPath -Encoding utf8 -Append

 }

 # Bronnen
 # https://learn.microsoft.com/en-us/windows/win32/psapi/process-memory-usage-information
&lt;/code&gt;&lt;/pre&gt;</description></item></channel></rss>