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
# Run as administrator! | |
$sharepath = "YOUR\PATH\HERE" | |
$Acl = Get-ACL $SharePath | |
$AccessRule= New-Object System.Security.AccessControl.FileSystemAccessRule("everyone","FullControl","ContainerInherit,Objectinherit","none","Allow") | |
$Acl.AddAccessRule($AccessRule) | |
Set-Acl $SharePath $Acl |
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
$NewColumnTitle = 'GRUPPODIP' | |
$NewColumnValue = '' | |
Import-csv anagrafica.csv | | |
Select-object *, @{Name=$NewColumnTitle; Expression={$NewColumnValue}} | | |
ConvertTo-csv -Delimiter ';' -NoTypeInformation | | |
Foreach-Object { $_.Replace('"','') } | | |
out-file anagrafica_GRUPPI.csv -encoding UTF8 |
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
$RootFolder = "ROOT_FOLDER_NAME" | |
# Services whose path contains $RootFolder | |
Get-CimInstance -ClassName Win32_service | Where-Object {$_.PathName -like "*$RootFolder*"} | Format-Table | |
# Web application whose physical path contains $RootFolder | |
$(Get-IISServerManager).Sites["Default Web Site"].Applications | Where-Object {$_.VirtualDirectories.PhysicalPath -like "*$RootFolder*"} | Format-Table |
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
# Root folder | |
$Path = "\YOUR-PATH-HERE" | |
# Regex pattern (in this example, something like "(2022_10_10 08_30 UTC)" | |
$pattern = ".[0-9]+_[0-9]+_[0-9]+ [0-9]+_[0-9]+ UTC." | |
foreach ($file in $(get-childitem $Path -Recurse) ) { | |
if ($file.Name -match $pattern){ | |
Rename-iTem $File.FullName $($($file.FullName).Replace($Matches[0],"")) | |
} |
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
import pyodbc | |
conn = pyodbc.connect(r'Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=C:\Users\Ron\Desktop\Test\test_database.accdb;') | |
cursor = conn.cursor() | |
cursor.execute('select * from DESTINATARI') | |
for row in cursor.fetchall(): | |
print (row) |
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
Set-Location C:\ | |
$global:desktop = $( Get-item '~\desktop' ).FullName | |
Set-PSReadLineOption -Colors @{ "string"="cyan" } | |
Import-Module oh-my-posh | |
Import-Module Terminal-Icons | |
Set-PoshPrompt -Theme space |
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
<# | |
.SYNOPSIS | |
It produces a list of the active connections and outputs to a file. | |
.DESCRIPTION | |
The script basically calls the Get-NetTcpConnection cmdlet to have a picture of the active connections. | |
Each connection is retrieved with all the details about the owning process. | |
The $Grouped switch let you group the results and sort them descending by amount of active connections. | |
The amount of free dynamic ports and the OS uptime are also printed. | |
.PARAMETER DESTINATIONFILEPATH | |
String containing the output file path. |
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
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
Vagrant.configure("2") do |config| | |
# Box | |
config.vm.box = "StefanScherer/windows_2019" | |
# Additional parameters to communicate with Windows | |
config.vm.boot_timeout = 60 |
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
function New-GitCommit { | |
[cmdletbinding()] | |
param( | |
[Parameter(Mandatory=$true)] | |
[string]$CommitMessage | |
) | |
Write-Host "Git - Adding all changes..." -ForeGroundColor Green | |
git add --all |