Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Thursday, April 21, 2011 8:12 AM
HI,
I am testing now PowrshellASP from nsoftware.com with IIS7.
I am having a problem to run powershell scripts from ASP pages for hosts which require an admin credential.
There is some problem with Application Pool Identities and some scripts are not working properly (because of credentials)
This happens because PowerShell executes all scripts and pipelines in a secondary thread that is not integrated into the regular ASP.NET thread pool,
and thus does not inherit the security and impersonation of the original thread processing the HTTP request. I don't want to change this behavior.
I have prepared simple webpage with Get-EventLog -computername $server -logName 'System' -EntryType Warning -Newest 10
Is there any way to create secure connection to the server with different credentials ?
I have used for other pages connect-QADservice but in this case is not working as this is for AD connections only.
I have also tried this but no luck:
$server = "testdc01"
$pw = convertto-securestring "P@ssw0rd" -asplaintext -force
$cred=new-object -typename System.Management.Automation.PSCredential -argumentlist "TEST\web_admin",$pw
Get-Credential $cred
Get-EventLog -computername $server -LogName 'DNS Server' -EntryType Warning -Newest 10 -
Is it possible to use get-eventlog as different user?
Thank you for any help.
Cheers,
Peter
All replies (3)
Thursday, April 21, 2011 8:20 AM âś…Answered | 2 votes
Instead of the Get-EventLog you may use the Get-WinEvent ,which support param the -Credential or use the Get-WmiObject and class Win32_NTLogEvent.
Friday, June 10, 2011 3:06 PM
Hi kazun,
can you provide a code snippet using credentials and Get-EventLog with Get-WmiObject and class Win32_NTLogEvent?
thanks!
Friday, June 10, 2011 7:31 PM
$cred = Get-Credential
$events = Get-WinEvent -Credential $cred
$wmievents = Get-WmiObject win32_NTLogEvent -computername $Server -Credential $cred