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
$ConfigPC = [ordered]@{ | |
'computer_Name' = (Get-CimInstance -ClassName Win32_ComputerSystem).Name | |
'OpearatingSystem' = (Get-CimInstance -ClassName Win32_OperatingSystem).Caption | |
'NbProcessors' = (Get-CimInstance -ClassName Win32_ComputerSystem).NumberofProcessors | |
'ProcessorName' = (Get-CimInstance -ClassName Win32_Processor).Name | |
'NbLogicalProcessors' = (Get-CimInstance -ClassName Win32_ComputerSystem).NumberOfLogicalProcessors | |
'RAM' = [Math]::Round((Get-CimInstance -ClassName Win32_ComputerSystem).TotalPhysicalMemory / 1GB , 2) | |
'HDD' = [Math]::Round((Get-CimInstance -ClassName Win32_DiskDrive).Size / 1GB , 2 ) |
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
$TaskName = 'MyScript' | |
$User= "NT AUTHORITY\SYSTEM" | |
$ScriptPath = "C:\scripts\script.ps1" | |
$Trigger= New-ScheduledTaskTrigger -At 22:00 -Daily | |
$Action= New-ScheduledTaskAction -Execute "PowerShell.exe" -Argument "-WindowStyle Hidden -executionpolicy unrestricted -noprofile -file $ScriptPath" | |
Register-ScheduledTask -TaskName $TaskName -Trigger $Trigger -User $User -Action $Action -RunLevel Highest -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
function Convert-WordToPDF | |
{ | |
<# | |
.SYNOPSIS | |
ConvertTo-PDF converts Microsoft Word documents to PDF files. | |
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
if( Get-AppxPackage *3dbuilder* -allusers ) { Get-AppxPackage *3dbuilder* -allusers | Remove-AppxPackage } | |
if( Get-AppxPackage *windowsalarms* -allusers ) { Get-AppxPackage *windowsalarms* -allusers | Remove-AppxPackage } | |
if( Get-AppxPackage *windowscommunicationsapps* -allusers ) { Get-AppxPackage *windowscommunicationsapps* -allusers | Remove-AppxPackage } | |
if( Get-AppxPackage *windowscamera* -allusers ) { Get-AppxPackage *windowscamera* -allusers | Remove-AppxPackage } | |
if( Get-AppxPackage *officehub* -allusers ) { Get-AppxPackage *officehub* -allusers | Remove-AppxPackage } | |
if( Get-AppxPackage *getstarted* -allusers ) { Get-AppxPackage *getstarted* -allusers | Remove-AppxPackage } | |
if( Get-AppxPackage *windowsmaps* -allusers ) { Get-AppxPackage *windowsmaps* -allusers | Remove-AppxPackage } | |
if( Get-AppxPackage *solitairecollection* -allusers ) { Get-AppxPackage *solitairecollection* -allusers | Remove-AppxPackage } |
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
# This function is used ti write Log for all scripting process | |
# personally i used it to track the job completion of my scripts | |
# As using example : Write-LogFile "Test Message" | |
$Output_Dir = 'C:\Report\' | |
$Output_LogFile = 'Log.txt' | |
function Write-LogFile | |
{ | |
[CmdletBinding()] |
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
# Create a temporary directory to store Brave64 | |
mkdir -Path $env:temp\Brave -erroraction SilentlyContinue | Out-Null | |
$Download = join-path $env:temp\Brave Brave64.exe | |
# Download the Brave installer. | |
Invoke-WebRequest 'https://laptop-updates.brave.com/latest/winx64/Brave64.exe' -OutFile $Download | |
# Install Google Brave using Powershell. | |
Invoke-Expression "$Download /install" |
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
# Create a temporary directory to store Google Chrome. | |
mkdir -Path $env:temp\chromeinstall -erroraction SilentlyContinue | Out-Null | |
$Download = join-path $env:temp\chromeinstall chrome_installer.exe | |
# Download the Google Chrome installer. | |
Invoke-WebRequest 'http://dl.google.com/chrome/install/375.126/chrome_installer.exe' -OutFile $Download | |
# Install Google Chrome using Powershell. | |
Invoke-Expression "$Download /install" |