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+ ‘, ‘ ’ |
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
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
$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
$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
-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
function get-hotfix2{ | |
param($computername) | |
#$PSBOundParameters | |
Get-HotFix @PSBOundParameters | | |
Select-Object description,hotfixid,installedby, @{l="InstalledOn";e={[DateTime]::Parse($_.psbase.properties["installedon"].value,$([System.Globalization.CultureInfo]::GetCultureInfo("en-US")))}} | |
} |
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
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
# for remote access use this | |
$Reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $computer1) | |
$RegKey= $Reg.OpenSubKey("SOFTWARE\\Veritas\\NetBackup\\CurrentVersion") | |
$NetbackupVersion1 = $RegKey.GetValue("PackageVersion") | |
#If you want to set a value, use | |
$RegKey= $Reg.OpenSubKey("SOFTWARE\\Veritas\\NetBackup\\CurrentVersion",$true) | |
then regkey.setvalue("Name","Myvalue") | |
# to access a registry path without a psdrive (hklm: etc.) use the registry provider : | |
cd registry::\HKEY_USERS |