This file contains 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
# Templata.ps1 | |
# author: Loic MICHEL | |
# date: 10/09/2013 | |
# abstract: make all errors terminating errors and send email + raise event in case of failure | |
# | |
[CmdletBinding()]param( | |
) |
This file contains 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
$p=read-host "password ?" -assecurestring | |
$Ptr = [System.Runtime.InteropServices.Marshal]::SecureStringToCoTaskMemUnicode($p) | |
$clearpassword = [System.Runtime.InteropServices.Marshal]::PtrToStringUni($Ptr) | |
[System.Runtime.InteropServices.Marshal]::ZeroFreeCoTaskMemUnicode($Ptr) | |
see more here | |
http://stackoverflow.com/questions/7468389/powershell-decode-system-security-securestring-to-readable-password |
This file contains 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 isVM{ | |
(gwmi win32_bios).version -match "vrtual" | |
} | |
or (from http://www.windowsnetworking.com/kbase/WindowsTips/Windows7/AdminTips/VirtualPlatforms/UsingPowerShelltodeterminewhetherWindowsisrunninginavirtualmachine.html) | |
Function isVM { | |
$objWMI = Get-WmiObject Win32_BaseBoard |
This file contains 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
Get-ChildItem C:\Test | Select-Object Name, CreationTime, @{Name="Kbytes";Expression={$_.Length / 1Kb}} |
This file contains 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
-f Format operator | |
Format a string expression. | |
Syntax: | |
"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"... |
This file contains 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
$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 |
This file contains 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
$string="http://server/app/index.php?var=val1&var2={0}" -f $event.providerName | |
(New-Object System.Net.WebClient).DownloadString("$string"); |
This file contains 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
Hi, | |
Please try below code: | |
$app = Get-WmiObject -Class Win32_Product | Where-Object { | |
$_.Name -match "Software Name" | |
} | |
$app.Uninstall() | |
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 | |
http://blogs.technet.com/b/heyscriptingguy/archive/2011/12/14/use-powershell-to-find-and-uninstall-software.aspx | |
wershell: Uninstall software on remote computer |
This file contains 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
# SMAC - LM - 05/05/2015 | |
<# | |
.Synopsis | |
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 | |
.Description | |
Utilisation de l'objet COM outlook afin de parcourir les dossiers. | |
This file contains 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
$text –replace ‘\s+ ‘, ‘ ’ |