Skip to content

Instantly share code, notes, and snippets.

View select3V3.ps1
###########################################
Write-Host ("You selected {0}" -f ('1','2','3' | Out-GridView -OutputMode Single -Title 'Please select a value'))
############################################
View UpdateCentos7to8.sh
#!/bin/bash
## Update Centos7 to Centos8 ##
#################################
## Подготовка
# Добавляем репозиторий EPEL
yum -y install epel-release
View Get-AutoMount.ps1
##*********************** ≠≠≠≠ ***********************
## 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
}
View Hyper-V_New-VHD.ps1
##*********************** ≠≠≠≠ ***********************
## 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
}
View Get-PowerShell.ps1
if ((Get-WmiObject win32_operatingsystem | select osarchitecture).osarchitecture -like "64*")
{
Write "... for Windows x64"
$OSx = 'x64'
} else {
Write "... for Windows x86"
$OSx = 'x86'
}
View .ps1
<#
##
## start as ADMIN
#>
##*********************** ≠≠≠≠ ***********************
## start as ADMIN
$currentUser = New-Object Security.Principal.WindowsPrincipal $([Security.Principal.WindowsIdentity]::GetCurrent())
$testadmin = $currentUser.IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator)
View Win10-DellAppx.ps1
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,
View Rename-Computer.ps1
$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;
View Installopensshwindowsx64_x86.ps1
##====================================================
## 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
}
View Markdown.md

GitHub Markdown

==================================================

Headers

This is an

tag

This is an

tag

This is an
tag