Hello,
I want to findout who is starting the script. I want to move a group and findout who has start the moving.
My SamAccountName is t2rehst and the SamAccountName from Quest is Questadm.
My problem is, everytimeI use whoami, it allways show me DOMAIN/Questadm. My account t2rehst will never displayed.
If I use $Request.whoami, so I get the following information
" System.Void WhoAmI(System.String&, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 accountName, System.String&, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 dn="I use t
Can I use the PublicKeyToken?
I try for example
function onPreMove($Request)
{
$SID_QUESTADM = "SID S-1-5-21-2076390139-743132798-1575050150-90725"
#snapin for Quest
Add-PSSnapin Quest.ActiveRoles.ADManagement
if ($Request.Class -eq "group")
{
$user = whoami
$EventLog.ReportEvent(2,"user : $($user)")
$name = $Request.name
if ($name -match "G-AUDI-AG-DISTMng")
{
# only move if account is questadm (SID S-1-5-21-2076390139-743132798-1575050150-90725)
$user1 = whoami
$EventLog.ReportEvent(2,"user : $($user1)")
$user1 = Get-QADUser $user -IncludeAllProperties
$user1 = $user.SID
$EventLog.ReportEvent(2,"userSiD : $($user)")
if($user -ne $SID_QUESTADM)
{
$msg = "Group $($name) can't moved."
throw $msg
}
}
}
}
the Scipt shows me allways DOMAIN/Questadm though I hast start the script. I hope you can catch my problem.
woody