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
$message = '(001945) 12/18/2018 10:50:47 AM - (not logged in) (127.0.0.1)> 530 Login or password incorrect!' | |
$message -match '(\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b)(.*)(incorrect!)' | |
$Matches[0] | |
$Matches[1] | |
$Matches[2] | |
$Matches[3] |
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
#Requires -Version 3.0 | |
# Configure a Windows host for remote management with Ansible | |
# ----------------------------------------------------------- | |
# | |
# This script checks the current WinRM (PS Remoting) configuration and makes | |
# the necessary changes to allow Ansible to connect, authenticate and | |
# execute PowerShell commands. | |
# | |
# All events are logged to the Windows EventLog, useful for unattended runs. |
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
# http://ilovepowershell.com/2015/09/10/how-to-check-if-a-server-needs-a-reboot/ | |
function Test-PendingReboot | |
{ | |
if (Get-ChildItem "HKLM:\Software\Microsoft\Windows\CurrentVersion\Component Based Servicing\RebootPending" -EA Ignore) { return $true } | |
if (Get-Item "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired" -EA Ignore) { return $true } | |
if (Get-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager" -Name PendingFileRenameOperations -EA Ignore) { return $true } | |
try { | |
$util = [wmiclass]"\\.\root\ccm\clientsdk:CCM_ClientUtilities" | |
$status = $util.DetermineIfRebootPending() | |
if(($status -ne $null) -and $status.RebootPending){ |
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
#!/bin/bash | |
########################################### | |
# Backup Ansible | |
########################################### | |
# auteur : atao | |
VERSION="2018.04.10" | |
# Source : https://github.com/blogmotion/bm-RaspberryPi/blob/master/Backup%20scripts/backupToNas.sh | |
# Source : https://tecadmin.net/mysql-database-backup-to-ftp-server-shell-script/ | |
# licence type : Creative Commons Attribution-NoDerivatives 4.0 (International) | |
# licence info : http://creativecommons.org/licenses/by-nd/4.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
function copy-ToZip($fileSaveDir){ | |
$srcdir = $fileSaveDir | |
$zipFile = "$env:localappdata\tmp\Report.zip" | |
if(-not (test-path($zipFile))) | |
{set-content $zipFile ("PK" + [char]5 + [char]6 + ("$([char]0)" * 18));(dir $zipFile).IsReadOnly = $false} | |
$shellApplication = new-object -com shell.application;$zipPackage = $shellApplication.NameSpace($zipFile) | |
$files = Get-ChildItem -Path $srcdir | |
foreach($file in $files){$zipPackage.CopyHere($file.FullName);while($zipPackage.Items().Item($file.name) -eq $null){Start-sleep -seconds 1 }} | |
} | |
$fileSaveDir = 'C:\Users\USER\AppData\Local\tmp\blabla' |
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
REM Info for an interface | |
Netsh WLAN show interfaces | |
Netsh WLAN show interface name="Interface_Name" | |
REM Export Wireless key | |
Netsh WLAN export profile key=clear folder="c:\Temp" | |
REM Import profile | |
Netsh WLAN add profile filename="File_Path.XML" |
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
Add-Type -AssemblyName System.Windows.Forms | |
Add-type -AssemblyName System.Drawing | |
$date = Get-Date -Format yyyyMMddHHmmss | |
$File = "C:\Temp\Shot-$date.bmp" | |
$Screen = [System.Windows.Forms.SystemInformation]::VirtualScreen | |
$Width = $Screen.Width | |
$Height = $Screen.Height | |
$Left = $Screen.Left |
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
# Vidéo Download from website using YouTube-dl | |
# Version 17/07/2017 | |
$data = Invoke-WebRequest "https://www.tf1.fr/tf1/c-est-canteloup" | |
# Get links | |
$data = $data.links | select href | |
# Remove Warning for exe | |
$env:SEE_MASK_NOZONECHECKS = 1 | |
foreach ($line in $data){ | |
if ($line.href -like "https://www.tf1.fr/tf1/c-est-canteloup/videos/*") |
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
# http://community.idera.com/powershell/powertips/b/tips/posts/encrypting-text-information-using-passphrase | |
function encrypt{ | |
param( | |
[string]$pass, | |
[string]$text | |
) | |
$key = [Byte[]]($pass.PadRight(24).Substring(0,24).ToCharArray()) | |
# $secure = $text | ConvertTo-SecureString -AsPlainText -Force | ConvertFrom-SecureString -Key $key | |
$secure = $text | | |
ConvertTo-SecureString -AsPlainText -Force | |
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
# http://www.ghislain-lerda.com/2016/10/07/change-wallpaper/ | |
$wallpaperPath = "mon_image.png" | |
$setwallpapersource = @" | |
using System.Runtime.InteropServices; | |
public class wallpaper | |
{ | |
public const int SetDesktopWallpaper = 20; | |
public const int UpdateIniFile = 0x01; | |
public const int SendWinIniChange = 0x02; |