小编Joh*_*gle的帖子

Powershell 2.0 Param关键字错误

我正在运行Windows 7 RTM.默认情况下安装Powershell 2.0.我正在使用优秀的Windows Powershell ISE来编辑我的脚本.我有以下脚本:

Param($p)
Param($d)
echo $p $d
Run Code Online (Sandbox Code Playgroud)

我将脚本保存为SayItAgain.ps1.当我尝试从交互式shell运行此脚本时,如下所示:

./SayItAgain -p "Hello"
Run Code Online (Sandbox Code Playgroud)

我收到以下错误:

At C:\users\cius\Code\powershell\SayItAgain.ps1:2 char:6
+ Param <<<< ($destination)
    + CategoryInfo          : ObjectNotFound: (Param:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
Run Code Online (Sandbox Code Playgroud)

这是一个已知问题还是我只是错误使用它?

powershell

42
推荐指数
2
解决办法
5万
查看次数

我可以在.NET中模拟其他Active Directory域上的用户吗?

我有两个Active Directory域,A和B.域A中的用户需要在其桌面上运行应用程序以查看和操作位于域B中的服务器上的资源.每个用户在域B中也有一个帐户.是否可能模仿每个用户的域B身份以编程方式对域B资源执行操作?

示例工作流程:

  1. 用户登录域A.
  2. 用户启动桌面应用程序.
  3. 用户指定域B中的资源.
  4. 应用程序提示用户输入域B凭据.
  5. 应用程序模拟用户的域B身份以访问指定的资源.
  6. 用户使用应用程序操纵域B资源.

.net impersonation active-directory cross-domain

7
推荐指数
2
解决办法
2万
查看次数