- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在寻找一种方法来将当前 session 的网络凭据捕获到一个我可以稍后传递的变量中......
关键是在我有帐户访问/特权的外部域上执行命令,但源域和目标域之间没有信任。
首先,我们在使用 runas 命令(runas/netonly/user:domian\account powershell)生成的 powershell 中运行
从这里我可以做几乎所有我想做的事情,除了在任务调度程序中创建一个事件而不将用户名/密码硬编码到命令行中
调用命令 -computer $destination -scriptblock {schtasks -ru domain\account -rp 密码}
我想做的是像
$username = 获取当前 session 网络用户名($(whoami) 显示实际的本地 longon 帐户,而不是产生 powershell 窗口的 runas 帐户)
$password = 获取执行 RunAs 命令时输入的密码
最佳答案
根据输入的凭据创建安全 token 并针对 Active Directory 进行验证后,密码将不再保留。它不能在其他地方检索和重用。只剩下 token 。这是设计使然。
更新 :
我进一步挖掘以支持我的案例,它与上面的不太一样,但最终结果是一样的。与 runas.exe
一起使用的密码似乎不可用。网络凭据为 不是 针对 AD 进行了验证,回想起来这很有意义,因为您经常使用 /netonly
使用远程、不受信任的域:根据定义,您无法验证来自本地系统的远程凭据。来自 MSDN:
这是标志 LOGON_NETCREDENTIALS_ONLY
的信息, 与 CreateProcessWithLogonW
一起使用.
Log on, but use the specified credentials on the network only. The new process uses the same token as the caller, but the system creates a new logon session within LSA, and the process uses the specified credentials as the default credentials.
This value can be used to create a process that uses a different set of credentials locally than it does remotely. This is useful in inter-domain scenarios where there is no trust relationship.
The system does not validate the specified credentials. Therefore, the process can start, but it may not have access to network resources.
runas.exe
?让我们来看看:
PS> runas /netonly /user:foo\bar powershell.exe
Enter the password for foo\bar: ******
foo\bar
对于上面的域和用户。如前所述,它未经验证。我输入了
12345
密码。上面的行将启动一个新的 powershell 实例。所以,从那个新实例中,让我们看看默认的网络凭据:
PS> [System.Net.CredentialCache]::DefaultNetworkCredentials
UserName Domain
-------- ------
关于Powershell:从 runas/netonly 启动时发现默认网络凭据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15689070/
当尝试使用 runas 命令在不同用户帐户下在 Windows Server 2008 上运行 IE 时,我收到消息“不支持 RUNAS 命令”。此命令适用于其他应用程序,但不适用于 IE。还有其他人
我有一个需要使用其他用户名运行的应用程序。 我试图调用“ runas.exe”来调用调用我的应用程序的批处理文件。 当我在命令提示符下尝试此方法时,它工作正常。缺点之一是我必须提供密码 我想知道这是否
Glassfish-3.1.2.2。 我的项目中有 1 个 Servlet 和 2 个 EJB。 Servlet--------->初始化---------------->打印 //EJB 初始化代码
我有一个应用程序,我试图在 Windows 7 和 Windows XP 瘦客户端上运行,但我似乎无法正确获取 runas.exe 命令行。我知道我需要其中的反斜杠转义字符,以便 runas 正确解释
我试图让一个批处理文件自动将密码输入“runas”程序,但我无法让它工作。到目前为止,这是我的批处理文件: echo password | runas /user:testuser c:/path/t
我想通过启动文件夹中的批处理文件从启动时运行一个程序,该文件是这样的: runas.exe/savecred/"user:pedro burgos""%cd%\test.bat" 但是,问题是当我运行
我的应用程序由ShellExecuteEx使用“runas”动词启动了新过程,以获取管理员特权。新过程在用户文件夹中创建了一些文件,但是内置用户无法读取文件。只有管理员可以访问这些文件。在XP和V
我尝试从java docs了解@RunAs注释的使用但我不明白它的用途。谁能解释一下吗? 我的理解是,在某些情况下,如果具有不同角色的经过身份验证的用户想要访问仅允许具有特定角色的用户访问的ejb方法
我正在尝试编写一个批处理脚本,该脚本将为任何给定的 Windows 服务(使用 explorer.exe 进行测试)执行 RunAs,可以在运行时输入任何给定的用户。我目前拥有的是这个。 set /p
关闭。这个问题不满足Stack Overflow guidelines .它目前不接受答案。 想改善这个问题吗?更新问题,使其成为 on-topic对于堆栈溢出。 8年前关闭。 Improve thi
这个 var psi = new ProcessStartInfo("cmd") { Verb = "runas",
@RunAs 注释允许仅通过指定角色名称来访问 bean。这意味着任何外部客户端只需指向角色名称就可以轻松访问我的 bean,不是吗? 我认为调用者和bean位于不同的服务器上。 如果伪造客户端这么容
是否可以使用 runas 参数在 Windows 注册表中添加启动条目?那么当它启动时,它会以指定的用户身份运行? 最佳答案 看这个食谱: Reading from and writing to th
背景: 在我的组织中,有一个应用程序用于某些关键功能,但它只有在以特定用户身份运行时才能发挥最佳作用。 原因是应用程序将其大量配置存储为本地用户 session ,因此它成为多用户噩梦,这意味着我们不
我必须自动化测试用例。 任务:- 步骤:- 从 powershell 打开管理命令提示符。 步骤:- 在管理命令提示符下执行批处理文件。 步骤:- 批处理文件包括一些命令集,包括 exe 的执行。 例
我正在尝试编写一个 C# 程序,它应该从 Windows 调用 runas 工具并自动输入密码。 我尝试了什么: Process runas = new Process(); runas.StartI
复制代码 代码如下: Set Shell = CreateObject("WScript.Shell") Shell.Run "cmd /c @runas /use
我想运行一个带有 runas 命令的批处理文件。 是否可以在批处理文件中链接密码? 例如: runas/profile/user\domain 密码 提前感谢您的回答 最佳答案 替代解决方案 看起来好
我正在寻找一种方法来将当前 session 的网络凭据捕获到一个我可以稍后传递的变量中...... 关键是在我有帐户访问/特权的外部域上执行命令,但源域和目标域之间没有信任。 首先,我们在使用 run
我正在用 qt 开发一个应用程序,我需要使用 ShellExecuteEx 来启动一个应用程序。我正在运行一个批处理文件,我需要向它传递 2 个参数。第一个参数只是一个字母,但第二个参数是一个路径,可
我是一名优秀的程序员,十分优秀!