[英]Azure DSC with PowerShell 7
I am trying to automate DataGateway in Azure and recently in powershell 7 were released library to manage it.我正在尝试在 Azure 中自动化 DataGateway,最近在 powershell 中发布了 7 个库来管理它。 But the problem that Azure DSC working with Windows Powershell 5 and even if VM have installed powershell 7 it's not working.
但是Z3A580F142203677F1F0BC3089898F63F53Z DSC与ZAEA23489CE3AA9B6406EBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB281B81B81B841B21B2A7753DA83 DA83ACF36799999999999999999999999999999999999999990.9999999990号
Can someone suggest a proper way to do it?有人可以建议一个正确的方法吗?
Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Force
Install-PackageProvider Nuget -MinimumVersion 2.8.5.201 -Force | Out-Null
Install-Module -Name PowerShellGet -Force -AllowClobber
$LFHT = @ {
ItemType = 'Directory'
ErrorAction = 'SilentlyContinue'}
New - Item - Path C: \Foo@ LFHT | Out - Null
These commands use a PowerShell technique known as splatting.这些命令使用称为喷溅的 PowerShell 技术。 for more information, you can type:
有关更多信息,您可以键入:
Get-Help about _ splattin
Set-Location C:\Foo
$URI = "https://aka.ms/install-powershell.ps1"
Invoke-RestMethod -Uri $URI |
Out-File -FilePath C:\Foo\Install-PowerShell.ps1
Get-Help -Name C:\Foo\Install-PowerShell.ps1
$EXTHT = @ {
UseMSI = $true
Quiet = $true
AddExplorerContextMenu = $true
EnablePSRemoting = $true}
C:\Foo\Install-PowerShell.ps1 @EXTHT
The installation script that downloads the PowerShell 7 MSI Installation package then runs this code silently.下载 PowerShell 7 MSI 安装 package 的安装脚本然后静默运行此代码。
the name of the executable program you run to bring up the PowerShell 7 console is pwsh.exe.您运行以调出 PowerShell 7 控制台的可执行程序的名称是 pwsh.exe。
Another noticeable difference is that with PowerShell 7, there are no.PS1XML files.另一个明显的区别是,对于 PowerShell 7,没有 .PS1XML 文件。
Get-Childitem -Path $env:ProgramFiles\PowerShell\7 -Recurse |
Measure-Object -Property Length -Sum
$I = 0
$env:PSModulePath -split ';' |
Foreach-Object {
"[{0:N0}] {1}" -f $I++, $_}
Inside the ISE ISE内部
$PROFILE |
Format-List -Property *Host* -Force
from Windows PowerShell Console从 Windows PowerShell 控制台
powershell -Command '$Profile| Format-List -Property *Host*' -Force
Open pwsh.exe, and hit Enter to open a PowerShell 7 console.打开 pwsh.exe,然后按 Enter 打开 PowerShell 7 控制台。 After you open the PowerShell 7 console, verify the version by viewing the $PSVersionTable variable
打开 PowerShell 7 控制台后,通过查看 $PSVersionTable 变量来验证版本
$PSVersionTable
$ModFolders = $Env:PSModulePath -split ';'
$I = 0$
ModFolders |
ForEach-Object {"[{0:N0}] {1}" -f $I++, $_}
$PROFILE | Format-List -Property *Host* -Force
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.