powershell 设置Powershell环境

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了powershell 设置Powershell环境相关的知识,希望对你有一定的参考价值。

# requires full administrative permission
# start only manual in ISE Editor

# Execution Policy für Powershell Scripte setzen
Set-ExecutionPolicy -scope CurrentUser -ExecutionPolicy RemoteSigned -Force

# PowerShell Hilfe aktualisieren
update-help -Force
update-help -UICulture En-Us -Force

# Nach installation von git das Modul posh-git installieren
Update-Module PowerShellGet -Force
Install-Module -Name posh-git -Force
Get-Module -Name posh-git -ListAvailable

#WindowsPowerShell Verzeichnis und Default Profile anlegen
New-Item -Path (Split-Path -Parent -Path $profile) -ItemType Directory  
#New-Item -ItemType file $profile
Copy-Item -Path ("$env:USERPROFILE\OneDrive\Repository\Powershell\Profiles\" + (split-path -Path $profile -Leaf)) -Destination $profile

# Module installieren
New-Item -Path ((Split-Path -Parent -Path $profile) + '\Modules\PowershellISE') -ItemType Directory  
Copy-Item -Path ("$env:USERPROFILE\OneDrive\Repository\Powershell\Modules\PowershellISE\PowershellISE.psm1") -Destination "$home\Documents\WindowsPowerShell\Modules\PowershellISE\PowershellISE.psm1"

# ISESteriods installieren
install-module -Name isesteroids -Scope CurrentUser

# Download example profile for powershell git  (see http://mikefrobbins.com/2016/02/09/configuring-the-powershell-ise-for-use-with-git-and-github/)
$client = new-object System.Net.WebClient
$client.DownloadFile("https://raw.githubusercontent.com/mikefrobbins/PowerShell/dev/MrToolkit/profile.ps1",(split-path -path $profile -Parent) + '\Profile.Example_Posh-Git.ps1')

# Plaster installieren
Install-Module Plaster -Scope CurrentUser

# Azure Module
Install-Module AzureRM

# Pester installieren
$info = [Ordered]@{
    'Pester vorhanden' = (Get-Module -Name Pester -ListAvailable) -ne $null
    Version = (Get-Module -Name Pester -ListAvailable).Version
    'Aktuelle Version' = (Find-Module -Name Pester).Version
}

New-Object -TypeName PSObject -Property $info

# See Installation and Update of Pester at https://github.com/pester/Pester/wiki/Installation-and-Update
Install-Module -Name Pester -Force -SkipPublisherCheck

以上是关于powershell 设置Powershell环境的主要内容,如果未能解决你的问题,请参考以下文章

设置Windows PowerShell环境变量

powershell 在PowerShell中为Azure RM Terraform设置环境变量

powershell 使用PowerShell设置Windows环境变量。适用范围:整机,所有用户。

Powershell - 环境设置

Powershell - 环境设置

Powershell - 环境设置