企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
[TOC] ## Install-BinFile ``` Install-BinFile ` -Name <String> ` -Path <String> ` [-UseStart] ` [-Command <String>] ` [-IgnoredArguments <Object[]>] [<CommonParameters>] ``` ## Install-ChocolateyDesktopLink ``` Install-ChocolateyDesktopLink ` -TargetFilePath <String> ` [-IgnoredArguments <Object[]>] [<CommonParameters>] ``` ## Install-ChocolateyEnvironmentVariable ``` Install-ChocolateyEnvironmentVariable ` [-VariableName <String>] ` [-VariableValue <String>] ` [-VariableType {Process | User | Machine}] ` [-IgnoredArguments <Object[]>] [<CommonParameters>] ``` ## Install-ChocolateyPackage 根据远程文件下载,将软件安装到“程序和功能”中。当是本地文件或嵌入式文件时,请使用Install-ChocolateyInstallPackage。 ``` Install-ChocolateyPackage ` -PackageName <String> ` [-FileType <String>] ` [-SilentArgs <String[]>] ` [-Url <String>] ` [-Url64bit <String>] ` [-ValidExitCodes <Object>] ` [-Checksum <String>] ` [-ChecksumType <String>] ` [-Checksum64 <String>] ` [-ChecksumType64 <String>] ` [-Options <Hashtable>] ` [-File <String>] ` [-File64 <String>] ` [-UseOnlyPackageSilentArguments] ` [-UseOriginalLocation] ` [-IgnoredArguments <Object[]>] [<CommonParameters>] ``` 实例 ``` $packageName= 'bob' $toolsDir = "$(Split-Path -Parent $MyInvocation.MyCommand.Definition)" $url = 'https://somewhere.com/file.msi' $url64 = 'https://somewhere.com/file-x64.msi' $packageArgs = @{ packageName = $packageName fileType = 'msi' url = $url url64bit = $url64 silentArgs = "/qn /norestart" validExitCodes= @(0, 3010, 1641) softwareName = 'Bob*' checksum = '12345' checksumType = 'sha256' checksum64 = '123356' checksumType64= 'sha256' } Install-ChocolateyPackage @packageArgs ``` ## Install-ChocolateyPath 目录添加到环境变量中 ``` Install-ChocolateyPath ` -PathToInstall <String> ` [-PathType {Process | User | Machine}] ` [-IgnoredArguments <Object[]>] [<CommonParameters>] ``` 实例 ``` Install-ChocolateyPath "$($env:SystemDrive)\Program Files\MySQL\MySQL Server 5.5\bin" -PathType 'Machine' ``` ## Install-ChocolateyWindowsService 使用Install Util安装Windows服务, ``` Install-ChocolateyWindowsService ` -Name <string> ` -ServiceExecutablePath <string> ` [-Username <string>] ` [-Password <string>] ` [-DisplayName <string>] ` [-Description <string>] ` [-StartupType <ChocolateyWindowsServiceStartupType> {Unknown | Manual | Automatic | Disabled}] ` [-DoNotStartService] ` [-DoNotReinstallService] ` [<CommonParameters>] ``` 实例 ``` $toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)" $serviceExe = Join-Path $toolsDir 'service\dan-agent.exe' $packageArgs = @{ Name = 'dan' DisplayName = 'Dan Agent' ServiceExecutablePath = $serviceExe Username = 'DanTheBuilder' } Install-ChocolateyWindowsService @packageArgs` ``` ## Install-ChocolateyZipPackage 安装压缩包 ``` Install-ChocolateyZipPackage ` -PackageName <String> ` [-Url <String>] ` -UnzipLocation <String> ` [-Url64bit <String>] ` [-SpecificFolder <String>] ` [-Checksum <String>] ` [-ChecksumType <String>] ` [-Checksum64 <String>] ` [-ChecksumType64 <String>] ` [-Options <Hashtable>] ` [-File <String>] ` [-File64 <String>] ` [-IgnoredArguments <Object[]>] [<CommonParameters>] ``` 实例 ``` Install-ChocolateyZipPackage -PackageName 'sysinternals' ` -Url 'http://download.sysinternals.com/Files/SysinternalsSuite.zip' ` -UnzipLocation "$(Split-Path -Parent $MyInvocation.MyCommand.Definition)" ` -Url64 'http://download.sysinternals.com/Files/SysinternalsSuitex64.zip' ``` ## Start-ChocolateyWindowsService 启动win 服务 ``` Start-ChocolateyWindowsService ` -Name <string> ` [<CommonParameters>] ``` ## Stop-ChocolateyWindowsService ``` Stop-ChocolateyWindowsService ` -Name <string> ` [<CommonParameters>] ``` ## Test-ProcessAdminRights 测试管理员权限 ``` Test-ProcessAdminRights ``` ## Uninstall-BinFile 移除命令 ``` Uninstall-BinFile ` -Name <String> ` [-Path <String>] ` [-IgnoredArguments <Object[]>] [<CommonParameters>] ``` ## Uninstall-ChocolateyEnvironmentVariable 移除环境变量 ``` Uninstall-ChocolateyEnvironmentVariable ` -VariableName <String> ` [-VariableType {Process | User | Machine}] ` [-IgnoredArguments <Object[]>] [<CommonParameters>] ``` 实例 ``` Uninstall-ChocolateyEnvironmentVariable -VariableName 'bob' ``` ## Uninstall-ChocolateyPackage ``` Uninstall-ChocolateyPackage ` -PackageName <String> ` [-FileType <String>] ` [-SilentArgs <String[]>] ` [-File <String>] ` [-ValidExitCodes <Object>] ` [-IgnoredArguments <Object[]>] [<CommonParameters>] ``` 实例 ``` Uninstall-ChocolateyPackage -PackageName $packageName ` -FileType $installerType ` -SilentArgs "$silentArgs" ` -ValidExitCodes $validExitCodes ` -File "$file" ``` ## Uninstall-ChocolateyWindowsService ``` Uninstall-ChocolateyWindowsService ` -Name <string> ` [<CommonParameters>] ``` ## Uninstall-ChocolateyZipPackage ``` Uninstall-ChocolateyZipPackage ` -PackageName <String> ` -ZipFileName <String> ` [-IgnoredArguments <Object[]>] [<CommonParameters>] ``` 实例 ``` Uninstall-ChocolateyZipPackage '__NAME__' 'filename.zip' ``` ## Update-SessionEnvironment 使用Chocolatey软件包安装过程中发生的任何环境变量更改来更新当前Powershell会话的环境变量。 ``` Update-SessionEnvironment ```