Skip to content

Instantly share code, notes, and snippets.

View pashalvov's full-sized avatar
On work

Львов Павел pashalvov

On work
View GitHub Profile
<#
.SYNOPSIS
Draws graph in the Powershell console
.DESCRIPTION
Consumes datapoints and draws colored coded fully customizable graph in the Powershell console.
.PARAMETER Datapoints
Array of data points which is to be plotted on the graph
@pashalvov
pashalvov / Test-PipeInFunction.ps1
Created February 7, 2022 12:25
Тест pipe в функции Powershell
function Test-PipeInFunction
{
[CmdletBinding()]
[Alias()]
[OutputType([String])]
Param
(
[Parameter(Mandatory=$true,
ValueFromPipeline=$true,
ValueFromPipelineByPropertyName=$true,
@pashalvov
pashalvov / zabbix_telegram_js.js
Created February 7, 2022 15:24
Zabbix Telegram JS
var Telegram = {
token: null,
to: null,
message: null,
proxy: null,
parse_mode: null,
escapeMarkup: function (str, mode) {
switch (mode) {
case 'markdown':
### Хотим чтобы консолько балакала по аглицки
[System.Console]::OutputEncoding = [System.Text.Encoding]::UTF8
### Парсим
$DataOutput = (((quser) -replace '^>', '') -replace '\s{2,}', ',').Trim() | ForEach-Object {
if ($_.Split(',').Count -eq 5) {
Write-Output ($_ -replace '(^[^,]+)', '$1,')
} else {
Write-Output $_
}
@pashalvov
pashalvov / RSJob.ps1
Created April 18, 2022 21:52
Пример RSJob для тех кому лень гуглить
Clear-Host
### Host Console Settings
$ColorsTrue = @{ForegroundColor = "Black"; BackgroundColor = "Green"}
$ColorsFalse = @{ForegroundColor = "White"; BackgroundColor = "DarkRed"}
$ColorsError = @{ForegroundColor = "White"; BackgroundColor = "Red"}
$ColorsInfo = @{ForegroundColor = "DarkGray"}
$ColorsVerbose = @{ForegroundColor = "DarkYellow"}
### Paths to CMDLets
. C:\Powershell\Functions\Test-TCPing.ps1
. C:\Powershell\Functions\ConvertTo-Encoding.ps1
@pashalvov
pashalvov / Example-Progress-ETA.ps1
Created April 28, 2022 07:00 — forked from michaelvdnest/Example-Progress-ETA.ps1
An example of calculating ETA for a PowerShell progress bar.
# Data Source
$items = 1..85
# Loop
$items | ForEach-Object `
-Begin {
# Initialize Tracking
$total = $items.Count
$start = Get-Date
$i = 0
@pashalvov
pashalvov / zabbix_telegraf.js
Created June 3, 2022 09:06
Добавить смайлики в стандартный шаблон оповещений Zabbix
var Telegram = {
token: null,
to: null,
message: null,
proxy: null,
parse_mode: null,
escapeMarkup: function (str, mode) {
switch (mode) {
case 'markdown':
@pashalvov
pashalvov / Compress-1COldJournals.ps1
Last active June 8, 2022 14:33
Скрипт для сжатия старых журналов регистрации 1С
###
#
# Скрипт для архивации журнала регистрации 1С Предприятия 8.3 - https://gitlab.pravo.tech/p.lvov/compress-1coldjournals
#
###
$isDebug = $false
$ScriptVersion = [version]1.3
$StartScriptDate = Get-Date
$LogFileName = (Join-Path $PSScriptRoot ("\logs\" + (Get-Date).ToString("yyyy-MM-dd_HH-mm-ss") + '_1C_Journal_Compress.log'))
@pashalvov
pashalvov / Logoff-IdleUsers.ps1
Created August 30, 2022 12:19
Logoff Users Idle
Clear-Host
$LogFileName = (Join-Path $PSScriptRoot ("\logs\" + (Get-Date).ToString("yyyy-MM-dd_HH-mm-ss") + '_LogOff.log'))
function Log
{
[CmdletBinding()]
[Alias()]
#[OutputType([String])]
Param
#Requires -Version 7
#Requires -Modules SqlServer
#Install-Module SqlServer -Force
Clear-Host
Import-Module SqlServer
### Статус Debug
$IsDebug = $false