Tuesday, May 26, 2020

Power-Shell imp links and command

Power-Shell Web Access:


Powers shell basic command:

Get-Command
Get-Help
Get-Member
Find-Module 

Power shell Installed Module prerequisites:
 
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

PowerShell to install Hyper-V Role in server:

Enable-WindowsOptionalFeature -Online -FeatureName:Microsoft-Hyper-V -All

Remove Hyper-v Role:

DISM /Online /Disable-Feature:Microsoft-Hyper-V
  

CMD DISM command:Remove Hyper-v Role:

DISM /Online /Enable-Feature /All /FeatureName:Microsoft-Hyper-V
Install-WindowsFeature -Name Hyper-V -ComputerName -IncludeManagementTools -Restart  


Power shell command to install Google chrome in server and windows 10:

$LocalTempDir = $env:TEMP; $ChromeInstaller = "ChromeInstaller.exe"; (new-object    System.Net.WebClient).DownloadFile('http://dl.google.com/chrome/install/375.126/chrome_installer.exe', "$LocalTempDir\$ChromeInstaller"); & "$LocalTempDir\$ChromeInstaller" /silent /install; $Process2Monitor =  "ChromeInstaller"; Do { $ProcessesFound = Get-Process | ?{$Process2Monitor -contains $_.Name} | Select-Object -ExpandProperty Name; If ($ProcessesFound) { "Still running: $($ProcessesFound -join ', ')" | Write-Host; Start-Sleep -Seconds 2 } else { rm "$LocalTempDir\$ChromeInstaller" -ErrorAction SilentlyContinue -Verbose } } Until (!$ProcessesFound)

1 comment: