专业的编程技术博客社区

网站首页 > 博客文章 正文

【配置系统】PowerShellcmdlet配置电源

baijin 2024-08-11 13:47:51 博客文章 10 ℃ 0 评论

配置电源选项:使用PowerShell cmdlet或其他工具配置系统的电源选项,如休眠、睡眠、节能模式等。例如:

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Force

powercfg /hibernate on

powercfg /setactive scheme_min

配置远程连接:使用PowerShell cmdlet或其他工具配置远程连接选项,如启用远程桌面、配置远程访问等。例如:

Enable-PSRemoting -Force

Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\Terminal Server" -Name "fDenyTSConnections" -Value 0

配置时间和日期:使用PowerShell cmdlet或其他工具配置系统的时间和日期设置。例如:

Set-Date -Date "2023-12-15"

Set-TimeZone -Id "Pacific Standard Time"

设置默认程序:使用PowerShell cmdlet或其他工具设置系统中的默认程序,如浏览器、邮件客户端等。例如:

$urlAssociations = @{

".html" = "chromehtml"

".pdf" = "AcroExch.Document.DC"

}

$urlAssociations.GetEnumerator() | ForEach-Object {

$extension = $_.Name

$program = $_.Value

$progId = (New-Object -ComObject Shell.Application).FileExtents.Get($extension).ProgID

if ($progId -ne $program) {

$assocKey = "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\$extension\UserChoice"

Set-ItemProperty -Path $assocKey -Name ProgId -Value $program -Force

}

}

配置安全性选项:使用组策略或注册表编辑器设置系统的安全选项,如密码策略、用户权限等。例如:

Set-GPRegistryValue -Name "Default Domain Policy" -Key "HKLM\Software\Microsoft\Windows\CurrentVersion\Policies\System" -ValueName "EnableLUA" -Type DWord -Value 0

Set-GPRegistryValue -Name "Default Domain Policy" -Key "HKLM\Software\Microsoft\Windows\CurrentVersion\Policies\System" -ValueName "PasswordComplexity" -Type DWord -Value 1

Tags:

本文暂时没有评论,来添加一个吧(●'◡'●)

欢迎 发表评论:

最近发表
标签列表