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
'https://msdn.microsoft.com/en-us/library/office/aa202943%28v=office.10%29.aspx' | |
Set objShell = CreateObject("WScript.Shell") | |
WScript.Sleep 800 | |
objShell.SendKeys "^{ESC}" | |
WScript.Sleep 800 | |
objShell.SendKeys "cmd" | |
'objShell.SendKeys "^+{ENTER}" | |
'objShell.SendKeys "{LEFT}" | |
WScript.Sleep 800 | |
objShell.SendKeys "{ENTER}" |
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 Eject-CD | |
{ | |
$drives = Get-WmiObject Win32_Volume -Filter "DriveType=5" | |
if ($drives -eq $null) | |
{ | |
Write-Warning "Your computer has no CD drives to eject." | |
return | |
} | |
$drives | ForEach-Object { | |
(New-Object -ComObject Shell.Application).Namespace(17).ParseName($_.Name).InvokeVerb("Eject") |
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 | |
if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) { Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs; exit } | |
$code = @" | |
[DllImport("user32.dll")] | |
public static extern bool BlockInput(bool fBlockIt); | |
"@ | |
$userInput = Add-Type -MemberDefinition $code -Name UserInput -Namespace UserInput -PassThru |
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 -RunAsAdministrator | |
#OneLine | |
if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) { Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs; exit } | |
#Or | |
$Loc = Get-Location | |
"Security.Principal.Windows" | % { IEX "( [ $_`Principal ] [$_`Identity ]::GetCurrent() ).IsInRole( 'Administrator' )" } | ? { | |
$True | % { $Arguments = @('-NoProfile','-ExecutionPolicy Bypass','-NoExit','-File',"`"$($MyInvocation.MyCommand.Path)`"","\`"$Loc\`""); | |
Start-Process -FilePath PowerShell.exe -Verb RunAs -ArgumentList $Arguments; } } |
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
net use x: "\\Path\fonts" | |
x: | |
xcopy /y *.ttf %systemroot%\fonts | |
REG ADD "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts" /v "font1 (TrueType)" /t REG_SZ /d "font1.ttf" /f | |
REG ADD "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts" /v "font2 (TrueType)" /t REG_SZ /d "font2.ttf" /f | |
REG ADD "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts" /v "font3 (TrueType)" /t REG_SZ /d "font3.ttf" /f | |
REG ADD "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts" /v "font4 (TrueType)" /t REG_SZ /d "font4.ttf" /f |
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
$appname = @( | |
"*BingWeather*" | |
"*ZuneMusic*" | |
"*ZuneVideo*" | |
) | |
ForEach($app in $appname){ | |
Get-AppxPackage -Name $app | Remove-AppxPackage -ErrorAction SilentlyContinue | |
} |
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
$OutputEncoding = [System.Text.Encoding]::UTF8 | |
[Console]::OutputEncoding = [System.Text.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
#From http://www.scconfigmgr.com/2014/08/22/how-to-get-msi-file-information-with-powershell/ | |
function Get-MSIFileInformation | |
{ | |
param( | |
[parameter(Mandatory=$true)] | |
[ValidateNotNullOrEmpty()] | |
[System.IO.FileInfo]$Path, | |
[parameter(Mandatory=$true)] |
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
#RunInAdmin? | |
([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator) |
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
############################## | |
# Installation OCS via GPO # | |
############################## | |
#Auteur : atao | |
#Date : 29/11/2016 | |
#Chemin du fichier d'Installation | |
$executable = "\\[Chemin réseau de l'executable]\OCS-NG-Windows-Agent-Setup.exe" | |
#Récupération de la version du fichier |