Powershell 2.0 でこれを解決しましたが、レガシー アプリ用に Perl 5.10 に移植する必要があります。
INTERACTIVELY LOGON できない Windows サービス アカウント資格情報を perl スクリプトに$Account
andとして渡しました$Password
。$Account
変数には、ドメイン名と AD ユーザー アカウント名が含まれます。私のPowershellソリューション(ワンライナー)は次のとおりです。
PS C:\> New-PsSession -Credential (new-object -typename System.Management.Automation.PSCredential -argumentlist '$Account', (ConvertTo-SecureString '$Password' -AsPlainText -Force)); exit-PsSession;
新しい PsSession が作成されると、アカウントの検証に合格し、次のような STDOUT への出力が得られます。
Id Name ComputerName State ConfigurationName Availability
-- ---- ------------ ----- ----------------- ------------
1 Session1 localhost Opened Microsoft.PowerShell Available
検証が失敗した場合、STDERR に次のような出力が得られます。
[localhost] Connecting to remote server failed with the following error message
: Access is denied. For more information, see the about_Remote_Troubleshooting
Help topic.
+ CategoryInfo : OpenError: (System.Manageme....RemoteRunspace:Re
moteRunspace) [], PSRemotingTransportException
+ FullyQualifiedErrorId : PSSessionOpenFailed
これらの結果をプログラムで解析できます。Windows 上の Perl 5.10 でも同様のことをしたいと考えています。私がやりたいのは、対話型ログオンが拒否されることを念頭に置いて、アカウントに対してパスワードが機能することをテストすることだけです。何か案は?