![](/img/trans.png)
[英]how can i get html generated by a php script from another domain(cross-domain)
[英]How can i call PowerShell script in php to get the lastlogin data from two Domain Controllers in AD
我正在使用 PHP 并且因为下面提到的问题。
问题:Lastlogon 属性通过用户进行身份验证存储域控制器的时间戳。 例如,在身份验证期间,如果它使用 Domain1,那么它将更新该域控制器中的时间戳,反之亦然。 这同样适用于我的应用程序获取数据时,将显示身份验证期间该 DC 中的属性值。
由于我们的环境中有两个类型的人的主要和次要 DC,因此每个 DC 中的同一帐户的 LastLogon 属性值将根据用于身份验证的 DC 不同,因此它显示不同的 LastLogon。
请在此处找到更多详细信息
解决方案:
我们找到了一种编写 PowerShell 脚本的方法,用于从两个域控制器获取最后一个登录名,并在比较后发布最新的登录名。
脚本已准备就绪,我不知道如何从 PHP(Apache 服务器)放置和运行代码。 任何建议或分步程序都会有所帮助。 下面是放置 lastlogon 的代码。
$this->attributes = array("department","whencreated","whenchanged", "pwdlastset","lastlogon","objectsid","homedrive");
您可能正在寻找 shell_exec()。
您肯定需要安装 perl 才能运行 perl 脚本。
然后,在你的 PHP 中,你调用
$answer = shell_exec( 'yourscriptname.pl' )
或者
$answer = shell_exec( 'perl yourscriptname.pl' )
$answer 将包含 perl 脚本的输出。
编辑:根据服务器的配置和脚本的位置,您可能需要明确说明 perl 可执行文件和脚本的路径。
(此示例假设为 unix/linux)
$answer = shell_exec( '/usr/bin/perl /path/to/yourscriptname.pl' )
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.