Skip to content

Instantly share code, notes, and snippets.

View aymenjaz's full-sized avatar

Aymen EL JAZIRI aymenjaz

View GitHub Profile
@aymenjaz
aymenjaz / Desktop-Laptop Hardware Config.ps1
Created June 16, 2022 03:59
Desktop-Laptop Hardware Config
$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 )
@aymenjaz
aymenjaz / create Task Schedule.ps1
Created June 16, 2022 03:43
Create Task Schedule in windows operating System using Powershell
$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
<#
@aymenjaz
aymenjaz / Convert Word To PDF.ps1
Created June 16, 2022 03:41
The cmdlet queries the given source folder including sub-folders to find *.docx and *.doc files, converts all found files and saves them as pdf in the Destination folder. After completition, the Destination folder with the newly created PDF files will be opened with Windows Explorer.
function Convert-WordToPDF
{
<#
.SYNOPSIS
ConvertTo-PDF converts Microsoft Word documents to PDF files.
@aymenjaz
aymenjaz / Remove Windows 10 Bloatware.ps1
Created June 9, 2022 22:04
Remove Windows 10 Bloatware using Powershell , this is is necessary for quick preparing machines for work
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 }
@aymenjaz
aymenjaz / Write-LogFile.ps1
Last active June 9, 2022 21:58
This function is used ti write Log for all scripting process , personally i used it to track the job completion of my scripts
# 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()]
@aymenjaz
aymenjaz / installBrave.ps1
Created June 7, 2022 21:17
Automatically Download and install Brave Navigator. we need this script every time we install a new Windows server and we need to access internet , everyone know the error message that we have using internet explorer. this script is to remediate for this problem.
# 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"
@aymenjaz
aymenjaz / installChrome.ps1
Created June 7, 2022 21:16
Automatically Download and install Google Chrome. we need this script every time we install a new Windows server and we need to access internet , everyone know the error message that we have using internet explorer. this script is to remediate for this problem.
# 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"