Skip to content

Commit 367c728

Browse files
authored
Merge pull request #144 from KR-Sew/dev
Dev
2 parents 5e0f983 + e882e66 commit 367c728

9 files changed

Lines changed: 325 additions & 6 deletions

File tree

Assets/fzf-color.png

91.2 KB
Loading

Bash/Lxc/ReadMe.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,13 @@ A collection of useful Bash scripts to work with **LXC/LXD** conatainers for aut
1010

1111
## 📂 Description
1212

13-
- 📂 [Postgre](./Postgre/)
13+
- 📂 [**PostgreSQL**](./Postgre/)
1414

15-
</p>Installing or managing Postgre SQL on Debian/Ubuntu LXC/LXD container
15+
Installing or managing [![PostgreSQL](https://img.shields.io/badge/PostgreSQL-336791?style=flat&logo=postgresql&logoColor=white&logoSize=auto&labelColor=5197e1)](https://www.postgresql.org/) on [![Debian](https://img.shields.io/badge/Debian-607078?style=flat&logo=debian&logoColor=white&logoSize=auto&labelColor=a81d33)](https://www.debian.org/)
16+
[![Ubuntu](https://img.shields.io/badge/Ubuntu-607078?style=flat&logo=ubuntu&logoColor=white&logoSize=auto&labelColor=e95420)](https://ubuntu.com/download) into [![LXC/LXD](https://custom-icon-badges.demolab.com/badge/LXC_LXD-Containers-607078?style=flat&logo=lxd-lxc_logo&logoColor=grey&logoSize=auto&labelColor=grey)](https://documentation.ubuntu.com/lxd/stable-5.21/) container
1617

17-
[![PostgreSQL](https://img.shields.io/badge/PostgreSQL-336791?style=flat&logo=postgresql&logoColor=white&logoSize=auto&labelColor=5197e1)](https://www.postgresql.org/)
18-
19-
- 📂 [MySQL](./MySQL/)
20-
</p>Installing or managing Postgre SQL on Debian/Ubuntu LXC/LXD container
18+
- 📂 [**MySQL**](./MySQL/)
19+
Installing or managing **MySQL** on `Debian` / `Ubuntu` `LXC`/ `LXD` container
2120

2221
[![MySQL](https://img.shields.io/badge/MySQL-4479A0?style=flat&logo=mysql&logoColor=white&logoSize=auto&labelColor=336791)](https://www.mysql.com/)
2322

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# <img width="35" height="35" src="https://img.icons8.com/fluency/48/proxmox.png" alt="proxmox"/>Installing and Configuring Fibre Channel
2+
3+
[![Proxmox](https://img.shields.io/badge/proxmox-proxmox?style=flat&logo=proxmox&logoColor=%23E57000&labelColor=%232b2a33&color=gray)](https://learn.microsoft.com/en-us/windows/wsl/about)
4+
[![Bash](https://img.shields.io/badge/GNU%20Bash-4EAA25?style=flat&logo=gnubash&logoColor=white&logoSize=auto&labelColor=black)](https://www.gnu.org/software/bash/)
5+
[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
6+
7+
This is **How to** installing and configuring `FibreChannel` volumes on **Proxmox** host to use it for virtual environmemnt.
8+
9+
## 📂 Description
10+
11+
- 📂
12+
</p>
13+
- 📂
14+
</p>
15+
---
16+
17+
- 📄[README.md](ReadMe.md) # Project documentation
18+
19+
---
20+
21+
🔙 [back to 📂 Scripting](../)

Bash/Proxmox/LVM/ReadMe.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# <img width="35" height="35" src="https://img.icons8.com/fluency/48/proxmox.png" alt="proxmox"/>Installing and Configuring LVM
2+
3+
[![Proxmox](https://img.shields.io/badge/proxmox-proxmox?style=flat&logo=proxmox&logoColor=%23E57000&labelColor=%232b2a33&color=gray)](https://learn.microsoft.com/en-us/windows/wsl/about)
4+
[![Bash](https://img.shields.io/badge/GNU%20Bash-4EAA25?style=flat&logo=gnubash&logoColor=white&logoSize=auto&labelColor=black)](https://www.gnu.org/software/bash/)
5+
[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
6+
7+
This is **How to** installing and configuring `LVM` volume on **Proxmox** host to use it for virtual environmemnt.
8+
9+
## 📂 Description
10+
11+
- 📂 Manage user accounts
12+
</p>Installing or updating Awk (gawk version and set up it as default) on Debian/Ubuntu
13+
- 📂 [Convert disk image format](./CRM/)
14+
</p>
15+
---
16+
17+
- 📄[README.md](ReadMe.md) # Project documentation
18+
19+
---
20+
21+
🔙 [back to 📂 Scripting](../)

Bash/Proxmox/count_cores.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
sudo bash <<'EOF'
2+
total=0
3+
4+
while read -r vmid; do
5+
qm status "$vmid" | grep -q "status: running" || continue
6+
7+
config=$(qm config "$vmid")
8+
cores=$(awk -F': ' '/^cores:/ {print $2}' <<< "$config")
9+
sockets=$(awk -F': ' '/^sockets:/ {print $2}' <<< "$config")
10+
11+
cores=${cores:-1}
12+
sockets=${sockets:-1}
13+
14+
total=$((total + cores * sockets))
15+
done < <(qm list | awk 'NR > 1 {print $1}')
16+
17+
echo "Total vCPUs assigned to running VMs: $total"
18+
EOF

Bash/Proxmox/iSCSI/ReadMe.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# <img width="35" height="35" src="https://img.icons8.com/fluency/48/proxmox.png" alt="proxmox"/>Installing and Configuring iSCSI
2+
3+
[![Proxmox](https://img.shields.io/badge/proxmox-proxmox?style=flat&logo=proxmox&logoColor=%23E57000&labelColor=%232b2a33&color=gray)](https://learn.microsoft.com/en-us/windows/wsl/about)
4+
[![Bash](https://img.shields.io/badge/GNU%20Bash-4EAA25?style=flat&logo=gnubash&logoColor=white&logoSize=auto&labelColor=black)](https://www.gnu.org/software/bash/)
5+
[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
6+
7+
This is **How to** installing and configuring `iSCSI` initiator on **Proxmox** host to connect it to **SAN**
8+
9+
## 📂 Description
10+
11+
- 📂 Manage user accounts
12+
</p>Installing or updating Awk (gawk version and set up it as default) on Debian/Ubuntu
13+
- 📂 [Convert disk image format](./CRM/)
14+
</p>
15+
---
16+
17+
- 📄[README.md](ReadMe.md) # Project documentation
18+
19+
---
20+
21+
🔙 [back to 📂 Scripting](../)

Bash/fzf/ReadMe.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# <img src="https://git-scm.com/images/logos/downloads/Git-Icon-1788C.svg" width=35 alt="Instatll and update Git"> Install or Update Git and add emoji for a commit
2+
3+
[![Debian](https://img.shields.io/badge/Debian-607078?style=flat&logo=debian&logoColor=white&logoSize=auto&labelColor=a81d33)](https://www.debian.org/)
4+
[![Ubuntu](https://img.shields.io/badge/Ubuntu-607078?style=flat&logo=ubuntu&logoColor=white&logoSize=auto&labelColor=e95420)](https://ubuntu.com/download)
5+
[![WSL](https://img.shields.io/badge/WSL-Microsoft-blue?style=flat&logo=linux&logoColor=white&logoSize=auto&labelColor=4E9A06)](https://learn.microsoft.com/en-us/windows/wsl/about)
6+
[![Bash](https://img.shields.io/badge/GNU%20Bash-4EAA25?style=flat&logo=gnubash&logoColor=white&logoSize=auto&labelColor=black)](https://www.gnu.org/software/bash/)
7+
[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
8+
9+
There are scripts that can install **Git** and **Git cli** from source or update them.
10+
Notice: for the version since `v2.55` you need to have installed **Rust** in your system otherwise the script will have got the error. You could run [this script](../Rust/install_rust.sh) that will install the latest version of **Rust**.
11+
12+
## 📂 Description
13+
14+
- 📄[Git-commit_with_emo.sh](./Git-commit_with_emo.sh)
15+
</br>
16+
![Git](https://img.shields.io/badge/%20git%20-%23F05033.svg?style=flat&logo=git&logoColor=white&logoSize=auto&labelColor=23F05033)
17+
[![Run Script on Push](https://github.com/KR-Sew/Scripting/actions/workflows/sh-update-go.yml/badge.svg)](https://github.com/KR-Sew/Scripting/actions/workflows/sh-update-go.yml)
18+
</br> Add emoji to commit description
19+
- 📄[Update_Git_GitCli.sh](./Update_Git_GitCli.sh)
20+
</br>
21+
![Git](https://img.shields.io/badge/%20git%20-%23F05033.svg?style=flat&logo=git&logoColor=white&logoSize=auto&labelColor=23F05033)
22+
[![Run Script on Push](https://github.com/KR-Sew/Scripting/actions/workflows/sh-update-git-gitcli.yml/badge.svg)](https://github.com/KR-Sew/Scripting/actions/workflows/sh-update-git-gitcli.yml)
23+
</br> the script for update Git and Git cli from source
24+
25+
---
26+
27+
- 📄[README.md](ReadMe.md) # Project documentation
28+
29+
---
30+
31+
🔙 [back to 📂 Bash](../)
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# <img src="../../Assets/Powershell.svg" width="35" alt="PowerShell"> PowerShell Scripts Collection
2+
3+
[![PowerShell](https://custom-icon-badges.demolab.com/badge/.-Microsoft-blue.svg?style=flat&logo=powershell-core-eyecatch32&logoColor=white)](https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-windows?view=powershell-7.5)
4+
[![PowerShell](https://img.shields.io/badge/PowerShell-5.1%2B-blue?logo=powershell)](https://docs.microsoft.com/en-us/powershell/)
5+
[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
6+
7+
A collection of useful `PowerShell` scripts for **system administration**, **automation**, and **DevOps** workflows on **Windows**.
8+
9+
## 📂 Folder Description
10+
11+
- 📂 [Manage **Active Directory** users, groups and rights](./Accounts/) in `Accounts` folder
12+
13+
Folder contains powershell scripts designed for **managing user and group permissions** within the organization. The scripts facilitate the automation of tasks such as creating, modifying, and deleting user accounts and groups, as well as assigning and revoking access rights.
14+
15+
- 📂 [Manage **DNS** service](./DNS/) in `DNS` folder
16+
17+
Contains powershell scripts designed for management **DNS** records and **DNS** service.
18+
- `Get-SpecDNSRec.ps1`
19+
- `Move-DNSRecords.ps1`
20+
21+
- 📂 [Manage **Email** messaging system](./eMail/) in `eMail` folder
22+
23+
Contains powershell scripts designed for management messaging system like **MDaemon** and email client applications such as **MS Office Outlook**.
24+
25+
- 📂 [Manage **files** and **folders** and thing like these](./FileSystems/) in `FileSystem` folder
26+
27+
Contains scripts designed for efficient management of files, folders, and the filesystem.
28+
29+
- 📂 [These are small custom **CmdLet's**](./Functions/) in `Functions` folder
30+
31+
Contains custom **CmdLet**:
32+
- `Install-ZipPackages.ps1` for managing archived files and folders .
33+
- `Install-ZipPackageAdvance.ps1` the same but with some improvements.
34+
- `Watch-PrivGroupChanges.ps1`
35+
36+
- 📂 [Managing **Private Keys Infrastructure**](./PKI/) `PKI` folder
37+
38+
Contains scripts designed for management **PKI**.
39+
- `Export-Cert.ps1` export certificates
40+
- `Impoert-Cert.ps1` import certificates
41+
42+
- 📂 [Managing **PowerShell** settings](./PoSH/) `PoSH` folder
43+
44+
Contains scripts designed for managing `PowerShell` engine itself:
45+
- `Update-PowerShell.ps` for updating to the latest version.
46+
- `Update-PowerShell.txt` the same script but adapted to run just using **Copy&Paste** being in teminal session.
47+
- 📂 [Managing **Print services** settings](./PrintServices/) `PrintServices` folder
48+
49+
Contains powershell scripts designed for management **Print services** and **Print Server** role.
50+
51+
- 📂 [Managing **Remote Desktop Services** settings](./RDServices/) `RDServices` folder
52+
53+
Contains scripts designed for management **Remote Desktop Services** and **Remote Desktop connections**.
54+
55+
- 📂 [Manage System and Serviice scripts](./System-Services/)`System-Servicex` folder
56+
57+
Contains PowerShell scripts designed for managing system services, retrieving detailed system information, and configuring various system components. The scripts enable users to start, stop, and restart services, gather hardware and software details, and modify system settings to optimize performance and functionality.
58+
59+
- 📄[README.md](ReadMe.md) # Project documentation
60+
61+
---
62+
63+
🔙 [back to 📂 Powershell](../)
Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
#Requires -Version 5.1
2+
#Requires -RunAsAdministrator
3+
4+
<#
5+
.SYNOPSIS
6+
Increases the WinRM maximum SOAP envelope size.
7+
8+
.DESCRIPTION
9+
Resolves "The estimated response packet size exceeded the maximum allowed
10+
envelope size" by changing MaxEnvelopeSizekb, restarting WinRM, and
11+
confirming the applied value.
12+
13+
.EXAMPLE
14+
.\Set-WinRMMaxEnvelopeSize.ps1
15+
16+
.EXAMPLE
17+
.\Set-WinRMMaxEnvelopeSize.ps1 -MaxEnvelopeSizeKB 16384
18+
#>
19+
20+
[CmdletBinding()]
21+
param (
22+
[Parameter()]
23+
[ValidateRange(512, 1048576)]
24+
[int]$MaxEnvelopeSizeKB = 8192
25+
)
26+
27+
Set-StrictMode -Version Latest
28+
$ErrorActionPreference = 'Stop'
29+
30+
# -----------------------------------------------------------------------------
31+
# Display helpers
32+
# -----------------------------------------------------------------------------
33+
function Write-Section {
34+
param ([Parameter(Mandatory)][string]$Title)
35+
36+
Write-Host ''
37+
Write-Host $Title -ForegroundColor Cyan
38+
Write-Host ('=' * 79) -ForegroundColor DarkGray
39+
}
40+
41+
function Write-Info {
42+
param ([Parameter(Mandatory)][string]$Message)
43+
44+
Write-Host '[INFO] ' -ForegroundColor Cyan -NoNewline
45+
Write-Host $Message
46+
}
47+
48+
function Write-Ok {
49+
param ([Parameter(Mandatory)][string]$Message)
50+
51+
Write-Host '[ OK ] ' -ForegroundColor Green -NoNewline
52+
Write-Host $Message
53+
}
54+
55+
function Write-Fail {
56+
param ([Parameter(Mandatory)][string]$Message)
57+
58+
Write-Host '[FAIL] ' -ForegroundColor Red -NoNewline
59+
Write-Host $Message
60+
}
61+
62+
function Format-Size {
63+
param ([Parameter(Mandatory)][long]$SizeKB)
64+
65+
$sizeMB = $SizeKB / 1024
66+
return ('{0:N0} KB ({1:N2} MB / {2:N0} bytes)' -f $SizeKB, $sizeMB, ($SizeKB * 1KB))
67+
}
68+
69+
# -----------------------------------------------------------------------------
70+
# WinRM configuration helpers
71+
# -----------------------------------------------------------------------------
72+
function Get-MaxEnvelopeSize {
73+
$item = Get-Item -Path 'WSMan:\localhost\MaxEnvelopeSizekb'
74+
return [int]$item.Value
75+
}
76+
77+
function Set-MaxEnvelopeSize {
78+
param ([Parameter(Mandatory)][int]$SizeKB)
79+
80+
Set-Item -Path 'WSMan:\localhost\MaxEnvelopeSizekb' -Value $SizeKB -Force
81+
}
82+
83+
function Restart-WinRMService {
84+
Write-Info 'Restarting the Windows Remote Management service...'
85+
Restart-Service -Name 'WinRM' -Force
86+
87+
$service = Get-Service -Name 'WinRM'
88+
$service.WaitForStatus([System.ServiceProcess.ServiceControllerStatus]::Running,
89+
[TimeSpan]::FromSeconds(30))
90+
91+
if ($service.Status -ne 'Running') {
92+
throw "The WinRM service did not return to the Running state."
93+
}
94+
}
95+
96+
# -----------------------------------------------------------------------------
97+
# Main
98+
# -----------------------------------------------------------------------------
99+
try {
100+
Write-Section 'WinRM maximum envelope size configuration'
101+
102+
$service = Get-Service -Name 'WinRM' -ErrorAction Stop
103+
Write-Ok "WinRM service found. Current status: $($service.Status)."
104+
105+
$currentSizeKB = Get-MaxEnvelopeSize
106+
Write-Info "Current size : $(Format-Size -SizeKB $currentSizeKB)"
107+
Write-Info "Requested size: $(Format-Size -SizeKB $MaxEnvelopeSizeKB)"
108+
109+
if ($currentSizeKB -eq $MaxEnvelopeSizeKB) {
110+
Write-Ok 'The requested value is already configured; no change is required.'
111+
112+
if ($service.Status -ne 'Running') {
113+
Write-Info 'WinRM is not running. Starting the service...'
114+
Start-Service -Name 'WinRM'
115+
}
116+
}
117+
else {
118+
Write-Info 'Applying the new MaxEnvelopeSizekb value...'
119+
Set-MaxEnvelopeSize -SizeKB $MaxEnvelopeSizeKB
120+
Write-Ok 'The WinRM configuration has been updated.'
121+
122+
Restart-WinRMService
123+
Write-Ok 'The WinRM service restarted successfully.'
124+
}
125+
126+
$appliedSizeKB = Get-MaxEnvelopeSize
127+
128+
Write-Section 'Verification'
129+
Write-Ok "Applied size: $(Format-Size -SizeKB $appliedSizeKB)"
130+
Write-Ok "WinRM status: $((Get-Service -Name 'WinRM').Status)"
131+
132+
if ($appliedSizeKB -ne $MaxEnvelopeSizeKB) {
133+
throw "Verification failed. Requested $MaxEnvelopeSizeKB KB, but WinRM reports $appliedSizeKB KB."
134+
}
135+
136+
Write-Host ''
137+
Write-Host 'Configuration completed successfully.' -ForegroundColor Green
138+
exit 0
139+
}
140+
catch {
141+
Write-Host ''
142+
Write-Fail $_.Exception.Message
143+
Write-Host 'Run this script from an elevated Windows PowerShell console.' -ForegroundColor Yellow
144+
exit 1
145+
}

0 commit comments

Comments
 (0)