简体   繁体   English

在 Windows 10(非域)重置后运行脚本以启用 RDP

[英]Run a script after a Windows 10 (non-Domain) Reset to enable RDP

For the Reset function, I go to Settings > Updates and Security > Recovery > Reset this PC.对于重置 function,我 go 到设置 > 更新和安全 > 恢复 > 重置这台电脑。 So this is a choice that I make, and on that basis I want to choose for that system to run a script after the Reset - and we know that should be possible as we can create completely customised Windows installation ISOs that install apps and Features in a clean state, so can someone tell me how to do a quite simple things - to just get Windows to run a PowerShell script after that Reset?所以这是我做出的选择,在此基础上,我想为该系统选择在重置后运行脚本 - 我们知道这应该是可能的,因为我们可以创建完全自定义的 Windows 安装 ISO,在其中安装应用程序和功能一个干净的 state,所以有人能告诉我如何做一件非常简单的事情——让 Windows 在重置后运行 PowerShell 脚本吗?

Actually, I only want to run a couple of lines:实际上,我只想运行几行:

Set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server'-name "fDenyTSConnections" -Value 0
Enable-NetFirewallRule -DisplayGroup "Remote Desktop"

ie This will enable RDP and allow me to connect remotely and continue the configuration without having to plug in a monitor and keyboard and mouse all just to run the above two commands.即这将启用 RDP 并允许我远程连接并继续配置,而无需插入显示器和键盘和鼠标,所有这些都只是为了运行上述两个命令。 As per title, this is a non-Domain scenario so accessing the system as Domain Admin is not possible (and really a Domain should not be necessary, these are my systems on my local.network).根据标题,这是一个非域场景,因此无法以域管理员身份访问系统(实际上不需要域,这些是我在 local.network 上的系统)。

The other reason that should make all of the above completely possible is that performing a Reset is not an absolute reset as it retains user information (my main user is still there with the password intact), so just enabling RDP would make everything possible post-Reset.应该使上述所有内容完全成为可能的另一个原因是,执行重置不是绝对重置,因为它保留了用户信息(我的主要用户仍然在那里,密码完好无损),所以只要启用 RDP 就可以使一切成为可能重启。

For reference, nothing in the following have helped me to achieve this goal so far: Run a powershell script on a remote system with elevated permissions to enable remoting https://interfacett.com/blogs/how-to-remotely-enable-and-disable-rdp-remote-desktop作为参考,到目前为止,以下内容都没有帮助我实现这个目标: 在具有提升权限的远程系统上运行 powershell 脚本以启用远程处理https://interfacett.com/blogs/how-to-remotely-enable-and -禁用-rdp-远程桌面

The easiest way to do this is to download PStools from Microsoft and use psexec to give yourself remote access:最简单的方法是从 Microsoft 下载 PStools 并使用psexec为自己提供远程访问权限:

psexec \\machinename reg add hklm\system\currentcontrolset\control\terminal server /f /v fDenyTSConnections /t REG_DWORD /d 0

psexec \\machinename netsh firewall set service remoteadmin enable
psexec \\machinename netsh firewall set service remotedesktop enable

psexec will let you supply credentials with -u and -p psexec 将允许您使用-u-p提供凭据

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 从域上的服务器在非域目标上远程执行脚本 - Executing a script remotely on non-domain Target from server on Domain Powershell 脚本什么都不做,静默,在加入域的机器上,在非域机器上正常运行 - Powershell script does nothing, silently, on domain joined machine, runs normally on non-domain machines 列出非域系统上所有用户的最新Windows密码更改 - List Last Windows Password Change For All Users On A Non-Domain System 对非域服务器的Powershell远程注册表访问 - Powershell Remote Registry Access to Non-Domain Server Windows 10脚本以启用/禁用TCP端口 - Windows 10 script to enable/disable TCP port 当TFS客户端位于非域计算机上时,使用Powershell自动执行TFS任务 - Automating TFS tasks using Powershell when TFS client is on non-domain machine 通过 Powershell 从未加入域的计算机将 GPO 导出到 HTML - Exporting GPOs to HTML from non-domain joined computer via Powershell 使用 powershell 脚本自动启用 Windows 10 触摸键盘和全键盘 - Automatically enable Windows 10 touch keyboard & full keyboard with powershell script 确定Windows更新后用户是否可以RDP - Determine if users can RDP after Windows Update 如何在Windows 10的信息亭模式下运行自定义非窗口应用程序 - How to run custom, non window app in kiosk mode in windows 10
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM