Skip to content

Instantly share code, notes, and snippets.

Loïc MICHEL kayasax

  • Colas
  • France
Block or report user

Report or block kayasax

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
kayasax / Powershell Script Template.ps1
Last active Dec 22, 2015
Template for powershell script. Makes all errors "terminating" and send mail if error occurs
View Powershell Script Template.ps1
# Templata.ps1
# author: Loic MICHEL
# date: 10/09/2013
# abstract: make all errors terminating errors and send email + raise event in case of failure
View decrypt_securestring.ps1
$p=read-host "password ?" -assecurestring
$Ptr = [System.Runtime.InteropServices.Marshal]::SecureStringToCoTaskMemUnicode($p)
$clearpassword = [System.Runtime.InteropServices.Marshal]::PtrToStringUni($Ptr)
see more here
kayasax / isVM.ps1
Last active Sep 15, 2015
Determine if powershell runs within a virtual machine.
View isVM.ps1
function isVM{
(gwmi win32_bios).version -match "vrtual"
or (from
Function isVM {
$objWMI = Get-WmiObject Win32_BaseBoard
kayasax / calculatedProperty.ps1
Created Sep 9, 2015
Calculated property syntax
View calculatedProperty.ps1
Get-ChildItem C:\Test | Select-Object Name, CreationTime, @{Name="Kbytes";Expression={$_.Length / 1Kb}}
View stringformat.ps1
-f Format operator
Format a string expression.
"String with placeholders" -f "Array of values to place into the placeholders"
'Filename: {0} Created: {1}' -f $_.fullname,$_.creationtime
"{I,A:FS} {I,A:FS} {I,A:FS}.." -f "string0", "string1", "string2"...
kayasax / sccm.ps1
Last active Aug 29, 2015
powershell SCCM automation
View sccm.ps1
$UIResource = New-Object -ComObject UIResource.UIResourceMgr
#list available software
$UIResource.GetAvailableApplications() | select ID,PackageID,PackageName
#install a soft
$UIResource.ExecuteProgram('*','CT1005EE',$true) # ID, PackageID, execute after download
kayasax / callURL.ps1
Created May 21, 2015
équivalent de invoke-webrequest pour powershell V2.
View callURL.ps1
$string="http://server/app/index.php?var=val1&var2={0}" -f $event.providerName
(New-Object System.Net.WebClient).DownloadString("$string");
kayasax / remoteUninstall.ps1
Created May 7, 2015
remotely uninstall software
View remoteUninstall.ps1
Please try below code:
$app = Get-WmiObject -Class Win32_Product | Where-Object {
$_.Name -match "Software Name"
Please use invoke-command above code to run them on the remote computer, in addition, the below article should be helpful:
Use PowerShell to Find and Uninstall Software
wershell: Uninstall software on remote computer
kayasax / get-mailboxFolders.ps1
Created May 5, 2015
Afficher la liste des dossiers outlook ou trouver le chemin d'accès d'un dossier particulier
View get-mailboxFolders.ps1
# SMAC - LM - 05/05/2015
Recherche des dossiers dans outlook
Si un nom de dossier est passé en paramètre le script affichera son chemin d'accès,
Si aucun nom n'est fourni, le script liste tous les dossiers outlook
Utilisation de l'objet COM outlook afin de parcourir les dossiers.
kayasax / parsingLines.ps1
Created Apr 29, 2015
Comment parser un fichier organisé "en lignes" plutôt qu'en "colonnes"
View parsingLines.ps1
PARSING (log) files.
when log files contains several colums on the same line we can use importfrom-csv
but how to do when log files is organized 'by lines' ?
Name: ENC1
IPv4 Address:
Link Settings: Forced, 100 Mbit, Full Duplex
Name: ENC2
You can’t perform that action at this time.