GitHub Markdown
==================================================
Headers
########################################### | |
Write-Host ("You selected {0}" -f ('1','2','3' | Out-GridView -OutputMode Single -Title 'Please select a value')) | |
############################################ |
#!/bin/bash | |
## Update Centos7 to Centos8 ## | |
################################# | |
## Подготовка | |
# Добавляем репозиторий EPEL | |
yum -y install epel-release |
##*********************** ≠≠≠≠ *********************** | |
## start as ADMIN | |
$currentUser = New-Object Security.Principal.WindowsPrincipal $([Security.Principal.WindowsIdentity]::GetCurrent()) | |
$testadmin = $currentUser.IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator) | |
if ($testadmin -eq $false) { | |
Start-Process powershell.exe -Verb RunAs -ArgumentList ('-noprofile -noexit -file "{0}" -elevated' -f ($myinvocation.MyCommand.Definition)) | |
exit $LASTEXITCODE | |
} |
##*********************** ≠≠≠≠ *********************** | |
## start as ADMIN | |
$currentUser = New-Object Security.Principal.WindowsPrincipal $([Security.Principal.WindowsIdentity]::GetCurrent()) | |
$testadmin = $currentUser.IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator) | |
if ($testadmin -eq $false) { | |
Start-Process powershell.exe -Verb RunAs -ArgumentList ('-noprofile -noexit -file "{0}" -elevated' -f ($myinvocation.MyCommand.Definition)) | |
exit $LASTEXITCODE | |
} |
if ((Get-WmiObject win32_operatingsystem | select osarchitecture).osarchitecture -like "64*") | |
{ | |
Write "... for Windows x64" | |
$OSx = 'x64' | |
} else { | |
Write "... for Windows x86" | |
$OSx = 'x86' | |
} |
<# | |
## | |
## start as ADMIN | |
#> | |
##*********************** ≠≠≠≠ *********************** | |
## start as ADMIN | |
$currentUser = New-Object Security.Principal.WindowsPrincipal $([Security.Principal.WindowsIdentity]::GetCurrent()) | |
$testadmin = $currentUser.IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator) |
New-Item -Path $env:SYSTEMDRIVE\ -Name 'PS\List' -ItemType Directory | |
$FileList = "$env:SYSTEMDRIVE\PS\List\Listinstall.txt" | |
Get-AppxProvisionedPackage -online | select DisplayName > $FileList; cat $FileList; | |
get-help Get-AppxProvisionedPackage -examples | |
<# | |
############################################################################### | |
# Эта команда перечисляет пакеты приложений (.appx) в образе Windows, |
$NEWCOMPUTERNAME = MyPC; | |
echo "This PC Name - $env:COMPUTERNAME"; | |
if ($env:ComputerName -in $NEWCOMPUTERNAME) { | |
echo " | |
This is Computer - $env:COMPUTERNAME | |
======================================== | |
"; | |
exit | |
} else { | |
echo "Rename this Computer?"; pause; Rename-Computer -NewName $NEWCOMPUTERNAME -Force; |
##==================================================== | |
## start as ADMIN | |
$currentUser = New-Object Security.Principal.WindowsPrincipal $([Security.Principal.WindowsIdentity]::GetCurrent()) | |
$testadmin = $currentUser.IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator) | |
if ($testadmin -eq $false) { | |
Start-Process powershell.exe -Verb RunAs -ArgumentList ('-noprofile -noexit -file "{0}" -elevated' -f ($myinvocation.MyCommand.Definition)) | |
exit $LASTEXITCODE | |
} | |