View Single Post
Old 01-29-2008   #8 (permalink)
Robin Moffatt


 
 

Re: start-psjob - user credentials

Marco, Shay - thanks for your replies.

Shay, what I'm trying to do, along with code examples and output, is
detailed in my first posting on 24th Jan.
[Security.Principal.WindowsIdentity]::GetCurrent() is interesting,
thanks, I didn't know about it.

It seems the difference between my console and a psjob is the
AuthenticationType changes from Kerbos to NTLM respectively, and I
have one less group.
I can't figure out what that group is though, because I don't know how
to translate the GUIDs that WindowsIdentity returns.
This is the code I'm running, from the console and as a psjob

$id = [Security.Principal.WindowsIdentity]::GetCurrent()
$id
$id.groups.count
Add-PSSnapin Quest.ActiveRoles.ADManagement
get-qaduser -identity $id.name
(Get-QADUser -identity
([Security.Principal.WindowsIdentity]::GetCurrent().name)).memberof

from the console it works but as a psjob I get the error Access is
denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)) when it
tries to use the QAD cmdlet

Marco, I tried setting $server.ConnectionContext.LoginSecure = $true
but it didn't help.
Interestingly, it *does* work (leaving it at default, i.e. $true) for
a local instance of SQL Server, just not any remote instances.

Thanks.
My System SpecsSystem Spec