powershell - How to get the Application Group, SID & UserName in NetSqlAZMAN -
$appname = "myappname" #open store $azstore = new-object -comobject azroles.azauthorizationstore #access app $myapp = $azstore.openapplication($appname)
can please me in completing this.
you might find example useful:
# internal function download latest netsqlazman.dll nuget (if necessary) # , import current runspace. # can manually download installation package netsqlazman.codeplex.com , # add-type directly instead of function function _downloadandimportlatestnetsqlazmandll { $downloadurl = 'https://api.nuget.org/packages/netsqlazman-x86.3.6.0.15.nupkg' $localdir = join-path $env:temp 'netsqlazmanx86' $localnupkg = join-path $localdir 'netsqlazman-x86.3.6.0.15.nupkg' $dllpath = join-path $localdir 'lib\net40\netsqlazman.dll' if (-not (test-path $localdir)) { new-item -path $localdir -itemtype directory -force | out-null } if (-not (test-path $localnupkg)) { invoke-webrequest -uri $downloadurl -method -outfile $localnupkg | out-null } if (-not (test-path $dllpath)) { add-type -assemblyname system.io.compression.filesystem [system.io.compression.zipfile]::extracttodirectory($localnupkg, $localdir) } add-type -path $dllpath } _downloadandimportlatestnetsqlazmandll # initialization: $connectionstring = 'server=mysqlserverhostname; database=netsqlazmanstorage; integrated security=true' $appstorename = 'myappstorename' $appname = 'myappname' $appgroupname = 'myappgroupname' $azstorage = new-object netsqlazman.sqlazmanstorage($connectionstring) $azstore = $azstorage.getstore($appstorename) $azapp = $azstore.getapplication($appname) # example usage: $username = '' $members = $azapp.getapplicationgroup($appgroupname).getapplicationgroupallmembers() "members of application group $appgroupname are:" foreach ($member in $members) { $member.getmemberinfo([ref] $username) | out-null "user sid: $($member.sid.stringvalue)" "user display name: $username" } # see netsqlazman api reference: http://netsqlazman.codeplex.com/downloads/get/348377 # cleanup: $azapp.dispose() $azstore.dispose() $azstorage.dispose()
Comments
Post a Comment