Get-adgroup get-adgroupmember properties

Looking to combine 2 commands for csv output.
For every mail enabled group I need to pull Name, Members, Memberof, whencreated, Info, managedby
This gets the data but I want memberof and members in a format that an auditor can use.
get-adgroup -Filter {Proxyaddresses -Like "*"} -properties * | ft Name, Members, Memberof, whencreated, Modified, Managedby, info
how can I get the members and memberof in a  first name last name format for members and a display name format for memberof?
Thanks much

Hi,
Use a calculated property:
Get-ADGroup -Filter "ProxyAddresses -like '*'" -Properties Members,MemberOf,WhenCreated,Modified,ManagedBy,info |
Select Name,
@{N='Members';E={ ($_.Members | % { (Get-ADUser $_).Name } | Sort) -join ', ' }},
@{N='MemberOf';E={ ($_.MemberOf | % { (Get-ADGroup $_ -Properties DisplayName).DisplayName } | Sort ) -join ', ' }},
WhenCreated,
@{N='ManagedBy';E={ $_.ManagedBy | % { (Get-ADUser $_).Name } }},
Info |
Sort -Property Name |
Export-Csv .\groupInformation.csv -NoTypeInformation
This uses the Name property for the group members, you can adjust that if needed.
http://technet.microsoft.com/en-us/library/ff730948.aspx
Don't retire TechNet! -
(Don't give up yet - 13,085+ strong and growing)

Similar Messages

  • Properties of get-ADGroupMember

    I am trying to understand the difference in commands?
    if i run:
    Get-ADUser user ....i get a list of properties.
    Get-ADUser <user> -Properties * | Get-Member.....gives me all the hidden??? or non default "what is the correct" properties.
    get-adgroupmember group gives me 6 properties i can query. distinguishedName, name, distinguishedName, distinguishedName, distinguishedName, SID.
    Are there more? If there is how can i see it?
    Trying to learn and understand.
    Thanks for the help.,

    To get a list of properties of the members, you can throw the results into a loop:
    Get-ADGroupMember "GroupName" -Recursive | Foreach-Object ({ Get-ADUser $($_.samaccountname) -properties * | Format-Table Name,Whatever,Property,You,Want,To,See -auto })
    If you're looking for whether a group member is enabled/disabled or stale, you can use a tool I have in the gallery:
    https://gallery.technet.microsoft.com/Get-Group-Members-Status-dc38e36d
    - Chris Ream -
    **Remember, if you find a post that is helpful, or is the answer, please mark it appropriately.**

  • PowerShell script : Directory object not found error in Get-ADGroupMember

    I am new in powershell scripting. I am writing a script to add users in different AD Groups. while doing so I do the following:
    Check if the user already exist in the group:
    $mbr_exist = Get-ADGroupMember $grpname | Where-Object {$_.SamAccountName -eq $sam}
    If user does not exist then add the user to the group.
    When I manually run the script its runs flawless, without any errors. But when I schedule the script to run it gives an error as follows:
    3/30/2015 8:32:15 AM Directory object not foundAt + $mbr_exist = Get-ADGroupMember $grpname | Where-Object {$_.SamAc ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~ Error at Line:$mbr_exist = Get-ADGroupMember
    $grpname | Where-Object {$_.SamAccountName -eq $sam}
    The strange thing is the user for which it throws the error is present in the group.I am not sure why this error is occurring when scheduled. Can any one please help? All the suggestions will be appreciated
    Note: (The script is scheduled using Windows Task Scheduler)
    try
    # # Initialize the variables we will use
    $status = 'false'
    $drivename = "H:"
    $sysdate = Get-Date -UFormat "%m_%d_%Y"
    $foldername = $drivename + "\Script_Result\PowershellData"+ $sysdate
    $backup_folder = "$foldername\AD_Groups_Backup"
    $updatedGroup = "$foldername\Updated_AD_Groups_LogFiles"
    $LogFilePath = "$foldername\Log_Update_ADGroups"+$sysdate+".log"
    # # Initialize the arrays we will use
    $GroupArray = @()
    # # maintain log of program startup
    $logdate = get-date
    $logdate.ToString() + "`tStarted script to Update AD user Groups..." | Out-File -FilePath $LogFilePath
    # # Create a sub folder to store the backup files
    $fileexist = Test-Path $backup_folder -PathType Container
    if($fileexist -ne 'False')
    New-Item -ItemType Directory $backup_folder
    # # Create a sub folder to store Updated AD group Log files
    $fileexist = Test-Path $updatedGroup -PathType Container
    if($fileexist -ne 'False')
    New-Item -ItemType Directory $updatedGroup
    # # Take back up of the AD groups data
    Get-ADGroupMember -Identity "Group1" | Export-csv "$backup_folder\Group1_BackUP$sysdate.csv"
    Get-ADGroupMember -Identity "Group2" | Export-csv "$backup_folder\Group1_BackUP$sysdate.csv"
    Get-ADGroupMember -Identity "Group3" | Export-csv "$backup_folder\Group1_BackUP$sysdate.csv"
    Get-ADGroupMember -Identity "Group4" | Export-csv "$backup_folder\Group1_BackUP$sysdate.csv"
    (an so on..... 11 such groups )
    # # Fetch AD Users data
    $ADusers = Get-ADUser -filter {(EmployeeNumber -gt 1) -and (EmployeeNumber -ne "N/A") -and (Enabled -eq $true)} -Properties * | Sort-Object -Property EmployeeNumber
    $ADusers.Count
    foreach($u in $ADusers)
    $sam = $u.SamAccountName
    $empnum = $u.EmployeeNumber
    $mgr = $u.mgr
    $fsal = $u.'fsalary-Hourly'
    $comp = $u.Company
    $ofc = $u.Office
    Write-Host "$sam : $empnum : $mgr :$fsal : $comp : $ofc" -ForegroundColor Yellow
    $GroupArray = @()
    # # Check if the user fits in any of the 11 scenarios
    if($comp -eq "US")
    # scenario 7
    write-host "7. Add to US Employees"
    $GroupArray += "US Employees"
    if($mgr -eq "Y")
    Write-Host "1. ADD to US MAnagers"
    $group = "US Managers"
    $GroupArray += $group
    if(($fsal -eq "Hourly") -and ($ofc -ne "Canton"))
    Write-Host "3. Add to US Hourly (excluding Canton)"
    $group = "US Hourly (excluding Canton)"
    $GroupArray += $group
    if(($fsal -eq "Hourly") -and ($ofc -eq "Canton"))
    write-host "4. Add to US Canton Hourly"
    $group = "US Canton Hourly"
    $GroupArray += $group
    if(($fsal -eq "Salaried") -and ($ofc -eq "Corporate" -or $ofc -eq "Landis Lakes 1" -or $ofc -eq "Landis Lakes 2"))
    Write-Host "5. Add to US Salaried Corporate"
    $group = "US Salaried Corporate"
    $GroupArray += $group
    if(($fsal -eq "Salaried") -and ($ofc -ne "Corporate" -and $ofc -ne "Landis Lakes 1" -and $ofc -ne "Landis Lakes 2"))
    Write-Host "6. Add to US Salaried Plant"
    $group = "US Salaried Plant"
    $GroupArray +=$group
    elseif($comp -eq "canada")
    # scenario 9
    write-host "9. Canada Employees"
    $GroupArray += "Canada Employees"
    if($mgr -eq "Y")
    Write-Host "2. Add to Canada Managers"
    $group = "Canada Managers"
    $GroupArray += $group
    if($fsal -eq "Hourly")
    Write-Host "10. Add to Canada Hourly"
    $group = "Canada Hourly"
    $GroupArray += $group
    if($fsal -eq "Salaried")
    Write-Host "11. Add to Canada Salaried Plant"
    $group = "Canada Salaried Plant"
    $GroupArray += $group
    elseif($ofc -eq "Corporate" -or $ofc -eq "Landis Lakes 1" -or $ofc -eq "Landis Lakes 2")
    Write-Host "8. Add to Corporate Employees"
    $GroupArray += "Corporate Employees"
    write-host "Final Group List" -ForegroundColor Green
    $grplen = $GroupArray.Length
    #$GroupArray
    $grplen
    for($i= 0; $i -lt $grplen; $i++)
    $grpname = $GroupArray[$i]
    write-host "$sam will be added to Group : $grpname" -ForegroundColor Magenta
    # # Check if the user is already present in the Group
    $mbr_exist = Get-ADGroupMember $grpname | Where-Object {$_.SamAccountName -eq $sam}
    if($mbr_exist -eq $null)
    # #Add user to US Managers group
    Add-ADGroupMember -Identity $grpname -Members $sam
    Write-Host "1. User $sam is added to $grpname group" -ForegroundColor Green
    # # documenting the user list that are added to this group
    $grpmbr = New-Object PSObject
    $grpmbr | Add-Member -MemberType NoteProperty -Name "EmployeeNumber" -Value $empnum
    $grpmbr | Add-Member -MemberType NoteProperty -Name "SamAccountName" -Value $sam
    $grpmbr | Add-Member -MemberType NoteProperty -Name "Name" -Value $u.Name
    $grpmbr | Add-Member -MemberType NoteProperty -Name "DistinguishedName" -Value $u.DistinguishedName
    $grpmbr | Add-Member -MemberType NoteProperty -Name "mgr" -Value $mgr
    $grpmbr | Add-Member -MemberType NoteProperty -Name "Company" -Value $comp
    $grpmbr | Add-Member -MemberType NoteProperty -Name "Salary/Hourly" -Value $fsal
    $grpmbr | Add-Member -MemberType NoteProperty -Name "Office" -Value $ofc
    $grpmbr | Add-Member -MemberType NoteProperty -Name "ADGroup" -Value $grpname
    $grpmbr | Export-Csv "$updatedGroup\ADUsers_To_Group($grpname)_$sysdate.csv" -Append -NoTypeInformation
    else
    Write-Host "Member $sam already exist in $grpname group" -ForegroundColor Red
    $logdate = get-date
    $logdate.ToString() + "`tCompleted script to Update Update AD Groups..." | Out-File -FilePath $LogFilePath -Append
    $status = 'true'
    return $status
    catch
    $err_lineno = $error[0].InvocationInfo.ScriptLineNumber
    $err_line = $error[0].InvocationInfo.Line
    $ExceptionMessage = $_.Exception.Message
    #$ExceptionMessage
    $error_info = $error[0].ToString() + $error[0].InvocationInfo.PositionMessage
    Write-Host "$error_info " -ForegroundColor Red
    $FailedItem = $_.Exception.ItemName
    if($ExceptionMessage)
    $logdate.ToString() + "`t $error_info " | out-file "$foldername\ErrorLog_Update_AD_Groups$sysdate.log" -append
    "Line Number: $err_lineno . `nError at Line: $err_line" | out-file "$foldername\ErrorLog_Update_AD_Groups$sysdate.log" -append
    #Invoke-Item "C:\ErrorLog.log"
    $status = 'false'
    return $status

    Hi mdkelly, Sorry for such a late reply (due to credential issues).
    I am using Windows task scheduler to schedule the task. I am given the administrator access to the server (Windows Server 2012). So I think I set to run the script under system account.
    My apologies for asking this, am I missing something while scheduling the script through task scheduler?  how to check if the scheduled task is running under who's credentials? How to pass my (admin) credentials, so that the script execution won't face
    a problem? Any suggestion on the above questions will be helpful. (I tried to search on net for the questions but didn't get any conclusive answers)  
    Thanks in advance.

  • Get-adgroupmember gives operation timeout error

    Hi experts,
    i am tring to get the user names from few groups in AD. But it displays me an eror for few groups like
    ERROR :-
    At D:\All Scripts\AD Scripts\groupmember.ps1:7 (file:///D:/All%20Scripts/AD%20Scripts/groupmember.ps1:7) char:1
    + Get-ADGroupMember vpn_terminal_access | Foreach-object{
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : O
    perationTimeout: (vpn_terminal_access:ADGroup)
    [Get-ADGroupMember], TimeoutException
    + FullyQualifiedErrorId : ActiveDirectoryCmdlet:System.TimeoutException,Mi
    crosoft.ActiveDirectory.Management.Commands.GetADGroupMember
    SCRIPT -
    Get-ADGroupMember ABC | Foreach-object{
       $_.samaccountname | get-aduser -properties * | Ft name, emailaddress | out-file .\ABC.csv -enc utf8 -append
    ABC is group name. What i need to do ?

    Doesn't matter. The user principal is very easy to get.  It is the embedded Get-AdUser that is time consuming because it mkes Get-AdGroupMember wait on every member.  If any member is in another domain and the network is slow it can cause a timeout. 
    Yes= Using Get-ADGroup would be faster but it, too, returns an array of strings and NOT a comma delimited list.
    Under most circumstances the difference is trivial.  If the domains are remote then this is an issue.  One more reason to not place users in a group when remote. Place them in a group and place the group in the group.  Overall performance
    for everything is better and more reliable.  That is why it is designed that way.  In NT4 this was not as easy so NT4 was prone to this kind of failure. Too often Admins just add users to local groups when they are remote. They then complain about
    performance. It can very badly impact logon performance.
    Notice that this is a collection (array):
    PS C:\scripts> (Get-AdGroup testgrp -prop members).members.GetType()
    IsPublic IsSerial Name BaseType
    True False ADPropertyValueCollection System.Collections.CollectionBase
    For this property only it is a collection of strings. It can be a collection of any "ValueType"
    ¯\_(ツ)_/¯"

  • Get-ADGroupMember limitations

    Hi All,
    I am trying to run the following query:
    get-adgroup -Filter * -SearchBase "OU=Test,dc=domain,dc=com" | get-adgroupmember | get-aduser -Properties * | Select Name,postalCode
    and get the following error: Get-ADUser : A referral was returned from the server
    Test OU contains Universal Distribution Groups with memebers from different domains in the same forest.
    So I've figured running agains GC server should fix it but I've hit a limitation:
    get-adgroup -Server dcgc01.domain.com:3268 -Filter * -SearchBase "OU=Test,dc=domain,dc=com" | get-adgroupmember | get-aduser -Properties * | Select Name,postalCode
    and got the following error: Get-ADGroupMember : The operation is not supported on Global Catalog port.
    It's Server 2008R2 with PS version 2
    Thank you,
    Naz

    Not being able to control referral chasing behavior is my biggest gripe with the AD module right now.  If you're in a multi-domain environment, you may find it better to either use the Quest cmdlets, or write your own code using the System.DirectoryServices
    namespace.
    In this case, though, I'd just grab the Member attribute of each group, and make individual calls to Get-ADUser in a foreach loop.  This sidesteps the problem and allows you to keep using the simpler AD cmdlets:
    Get-ADGroup -Properties member -Filter * -SearchBase "OU=Test,dc=domain,dc=com" |
    ForEach-Object {
    $group = $_
    foreach ($dn in $group.member)
    Get-ADUser $dn -Properties Name,postalCode |
    Select-Object Name,postalCode
    Or, alternatively:
    Get-ADGroup -Properties member -Filter * -SearchBase "OU=Test,dc=domain,dc=com" |
    Select-Object -ExpandProperty member |
    ForEach-Object {
    $dn = $_
    Get-ADUser $dn -Properties Name,postalCode |
    Select-Object Name,postalCode

  • Get-adgroupmember says it completed successfully but displays nothing in Powershell

    I am trying to display all the members of administrators so I try
    Get-ADgroupmember -identity administrators
    and it returns
    Get-ADGroupmember : The operation completed successfully
    At line:1 Char:18
    + Get-ADgroupmember <<<<
           +CategoryInfo  "NotSpecified: (administrators:ADGroup) [Get-ADGroupMember], ADException
    What am I doing wrong?
    JF

    Hi,
    I have faced this error when the group contains foreign members. Try to use Get-ADGroup and access members property - it should work. PSB example:
    PS C:\> Get-ADGroupMember my_cool_group
    Get-ADGroupMember : The operation completed successfully
    At line:1 char:18
    + Get-ADGroupMember <<<< my_cool_group
    + CategoryInfo : NotSpecified: (my_cool_group:ADGroup) [Get-ADGroupMember], ADException
    + FullyQualifiedErrorId : The operation completed successfully,Microsoft.ActiveDirectory.Management.Commands.GetADGroupMember
    PS C:\> (Get-ADGroup my_cool_group -properties members).members
    CN=Citrixtest\, Citrixtest,OU=Ireland,OU=Users,DC=DOMAIN,DC=LOCAL
    CN=S-1-5-21-830052177-1794105578-3120254253-14766,CN=ForeignSecurityPrincipals,DC=DOMAIN,DC=LOCAL
    CN=S-1-5-21-830052177-1794105578-3120254253-14960,CN=ForeignSecurityPrincipals,DC=DOMAIN,DC=LOCAL
    CN=S-1-5-21-830052177-1794105578-3120254253-10641,CN=ForeignSecurityPrincipals,DC=DOMAIN,DC=LOCAL

  • Get-ADGroupMember -recursive Show Groupnames

    I'm new to Powershell and im trying to get a list of the Members of some AD-Groups. Each Group is related to two other Groups for Read and Change permissions. Like FS101_EXAMPLE has two members wich are FS101_EXAMPLE_C and FS101_EXAMPLE_R
    So far I've got the following Code:
    import-module ActiveDirectory
    $GRP = "Groupname"
    Get-ADGroupMember $GRP -recursive | select objectclass,name | export-csv C:\Scripts\Exports\$(get-date -f yyyy-MM-dd-hh-mm-ss)-$GRP.txt –NoTypeInformation -Encoding UTF8
    If i scan on "FS101_EXAMPLE" it works and i get a list of all Members of FS101_EXAMPLE_C and FS101_EXAMPLE_R but i should know how's in wich group.
    How can I get a List with the Groupnames on it?

    If I understand you correctly, it sounds like you're getting the list of members from FS101_EXAMPLE, and recursively returning the members of groups within this first group. Your output lists the users but doesn't distinguish from which group they belong.
    I'm looking at Get-ADGroupMember and I see this behavior as well. I have ADPrincipal objects but there's not way on the surface to see their group membership.
    There are likely a number of ways to reach your goal, here is one way using a recursive function.
    function Get-ADGroupMembers {
    param(
    [string]$GroupName
    $objects = @()
    $members = Get-ADGroupMember -Identity $GroupName
    foreach ($member in $members) {
    if ($member.objectClass -eq "group") {
    $objects += Get-AdGroupMembers -GroupName $member.Name
    $objects += @{
    "objectclass" = $member.objectClass;
    "name" = $member.Name;
    "group" = $GroupName
    } # foreach
    return $objects
    } # Get-AdGroupMembers
    Import-Module ActiveDirectory
    $GRP = "Groupname"
    $AllMembers = Get-ADGroupMembers -GroupName $GRP
    $AllMembers | Foreach-Object {New-Object psobject -Property $_ } | Export-Csv C:\Scripts\Exports\$(get-date -f yyyy-MM-dd-hh-mm-ss)-$GRP.txt –NoTypeInformation -Encoding UTF8
    What I'm doing here is I've created a recursive function Get-ADGroupMembers (maybe not the best name) that calls Get-ADGroupMember against the given group. It then gets the members, collects the properties we want and adds them to an array which the function
    returns. If there is a group in the group, it will call the function again with this subgroup. 
    I'm storing the properties you want, objectClass, and Name, as well as the name of the group in a hashtable. The function returns the array of hashtables which I then convert to an object and export to CSV (HT powershell
    convert array of hastables into csv).
    Jason Warren
    @jaspnwarren
    jasonwarren.ca
    habaneroconsulting.com/Insights

  • Get-AdGroupMember Question

    OK here's my problem, I'm not great with PowerShell. I understand a little but that's about it and here's me scenario.I am creating a process to add users to a domain local group but it is spread across 3 domains. My add script works like a charm but I need to add some error checking in so I want to check if the user is already a member first, if they aren't add them and then test to ensure they were actually added. If I use Get-ADUser it only looks at the user in that domain so does not show the user being a member of that group as it sits in another domain.if ((Get-ADUser $UserName -server $DomainController -Properties memberof).memberof -like $GroupDN){1}Else{0}So I think I need to do it the other way, search the group and then establish if the user is listed. I know I can use the Get-ADGroupMember function but that only returns a...
    This topic first appeared in the Spiceworks Community

    Hi,
    Based on the description, you have deleted the object for mail-enabled public folder "Equipment Contacts" under the Microsoft Exchange System Objects container, but you still get the warning provided above.
    First please check if you have other mail-enabled public folder object under the Microsoft Exchange System Objects container, make sure they have a valid alias.
    Besides, please update your public folder to check result.
    A similar thread for your reference.
    https://social.technet.microsoft.com/Forums/en-US/749276ac-b25c-4cb5-a033-9be51cbd28c8/getmailpublicfolder-lot-of-errors-with-aliases?forum=exchangesvrdeploylegacy
    Best regards,
    Belinda Ma
    TechNet Community Support

  • How to get all properties for an item with search?

    How can I get all crawled / managed properties back of an item with the search API (REST, client, or server)?
    Currently I am only aware of specifying the applicable properties specifcally by using the selectproperties parameters via REST:
    http://host/site/_api/search/query?querytext='terms'&selectproperties='Path,Url,Title,Author'
    (taken from http://blogs.msdn.com/b/nadeemis/archive/2012/08/24/sharepoint-2013-search-rest-api.aspx)
    I don't want to do this. I just want to get all properties back that
    are associated with the search results.

    Its my understanding that standard managed properties will be returned, like: Created Date, Last Date Modified, Author, Title, etc.  However, if you need more than that you will need to specify the properties to return.
    This blog post also has a similar thought process:
    http://www.blendmaster.net/blog/2012/09/view-managed-property-value-in-sharepoint-2013-using-search-rest-api/
    Brandon Atkinson
    Blog: http://brandonatkinson.blogspot.com

  • SSIS 2012 Script Task to Get File Properties

    Hello,
    I researched on how to grab a file properties such as file size, file modified date, etc and I came across the following
    link:
    I followed exact steps and when I went to execute the package, I got the following error:
    Below is the code:
    // C# code
    // Fill SSIS variables with file properties
    using System;
    using System.Data;
    using System.IO; // Added to get file properties
    using System.Security.Principal; // Added to get file owner
    using System.Security.AccessControl; // Added to get file owner
    using Microsoft.SqlServer.Dts.Runtime;
    using System.Windows.Forms;
    namespace ST_cb8dd466d98149fcb2e3852ead6b6a09.csproj
    [System.AddIn.AddIn("ScriptMain", Version = "1.0", Publisher = "", Description = "")]
    public partial class ScriptMain : Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTARTScriptObjectModelBase
    #region VSTA generated code
    enum ScriptResults
    Success = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Success,
    Failure = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure
    #endregion
    public void Main()
    // Lock SSIS variables
    Dts.VariableDispenser.LockForRead("User::FilePath");
    Dts.VariableDispenser.LockForWrite("User::FileAttributes");
    Dts.VariableDispenser.LockForWrite("User::FileCreationDate");
    Dts.VariableDispenser.LockForWrite("User::FileExists");
    Dts.VariableDispenser.LockForWrite("User::FileInUse");
    Dts.VariableDispenser.LockForWrite("User::FileIsReadOnly");
    Dts.VariableDispenser.LockForWrite("User::FileLastAccessedDate");
    Dts.VariableDispenser.LockForWrite("User::FileLastModifiedDate");
    Dts.VariableDispenser.LockForWrite("User::FileOwner");
    Dts.VariableDispenser.LockForWrite("User::FileSize");
    // Create a variables 'container' to store variables
    Variables vars = null;
    // Add variables from the VariableDispenser to the variables 'container'
    Dts.VariableDispenser.GetVariables(ref vars);
    // Variable for file information
    FileInfo fileInfo;
    // Fill fileInfo variable with file information
    fileInfo = new FileInfo(vars["User::FilePath"].Value.ToString());
    // Check if file exists
    vars["User::FileExists"].Value = fileInfo.Exists;
    // Get the rest of the file properties if the file exists
    if (fileInfo.Exists)
    // Get file creation date
    vars["User::FileCreationDate"].Value = fileInfo.CreationTime;
    // Get last modified date
    vars["User::FileLastModifiedDate"].Value = fileInfo.LastWriteTime;
    // Get last accessed date
    vars["User::FileLastAccessedDate"].Value = fileInfo.LastAccessTime;
    // Get size of the file in bytes
    vars["User::FileSize"].Value = fileInfo.Length;
    // Get file attributes
    vars["User::FileAttributes"].Value = fileInfo.Attributes.ToString();
    vars["User::FileIsReadOnly"].Value = fileInfo.IsReadOnly;
    // Check if the file isn't locked by an other process
    try
    // Try to open the file. If it succeeds, set variable to false and close stream
    FileStream fs = new FileStream(vars["User::FilePath"].Value.ToString(), FileMode.Open);
    vars["User::FileInUse"].Value = false;
    fs.Close();
    catch (Exception ex)
    // If opening fails, it's probably locked by an other process
    vars["User::FileInUse"].Value = true;
    // Log actual error to SSIS to be sure
    Dts.Events.FireWarning(0, "Get File Properties", ex.Message, string.Empty, 0);
    // Get the Windows domain user name of the file owner
    FileSecurity fileSecurity = fileInfo.GetAccessControl();
    IdentityReference identityReference = fileSecurity.GetOwner(typeof(NTAccount));
    vars["User::FileOwner"].Value = identityReference.Value;
    // Release the locks
    vars.Unlock();
    Dts.TaskResult = (int)ScriptResults.Success;
    Eventually I am looking to just grab the Modified Date from the Windows Explorer folder and insert into table. Any suggestions? Thank you in advance!
    Sanjeev
    Sanjeev Jha

    Hi SSISJoost,
    I am so glad you responded to this thread. You are absolutely right. I copied the entire code including the project name (guid) and that solved the error problem.
    Now, what did you do to get the message box? I added the watch and I could see the values but how do I get these values in a table? If I remember correctly, in your blog, you mentioned something about using derived columns. I am familiar with Derived Columns
    but how do I do that? I appreciate your response.
    Thank you.
    Sanjeev
    Sanjeev Jha
    I used a second script task to show all variable values. It has a
    MessageBox in it and between all
    variables I added a
    newline to make it more readable...
    But with an Execute SQL Task and parameters you can also put these values in a Table... or you can read the file in a Data Flow Task and add those variables (as metadata) to each record with a Derived Column
    Please mark the post as answered if it answers your question | My SSIS Blog:
    http://microsoft-ssis.blogspot.com |
    Twitter

  • How to get Node Properties by js script?

    I have a customised client script implementing some functions similair to "CQ.wcm.SiteAdmin.scheduleForActivation".
    But when the user trigger the dialog and before the submission, I'd like to do some processes with the properties of some nodes (components in some parsys).
    My question is... I know in .jsp, I can get the properties of a node by node.getProperty("someProp");
    But... How can I achieve the same result in .js scripts?

    Hi Matthias,
               I am also facing same scenario. Could you please tell me how you resolved this or did you able to find out any alternative for this. Please help me.
    Regards,
    Mahidhar,
    [email protected]

  • Getting attribute properties from client tier is too slow

    Getting properties for view object attributes is too slow, because a called to the server is made for every attribute.
    I noticed that when a property is gotten for an attribute all properties are retrieved for it, but I couldn't found a way to get all properties for all attributes in the ViewObject.

    See ApplicationModule.fetchAttributeProperties and it's usage in JClient in JDeveloper 9.0.3

  • BAPI  to get all properties of all levels of all hierarchies of a cube

    Hi Experts,
    Is there are way to get all properties of all levels of all hierarchies of all dimensions of a cube (InfoCube, ODSObject, QueryCube, InfoSet)  in one BAPI call?
    I use BAPI_MDPROVIDER_GET_PROPERTIES, and only set input parameters: CAT_NAM, CUBE_NAM. But it only returns all Level1's properties.
    Any useful answer will be awarded with suitable points.
    Thanks,
    Rohan

    Hi,
    Thanks for giving reply.
    Recommended Function module is not a RFC, so it is not working.
    Thanks,
    Rohan

  • Get-ADGroupMember runing issue

    Hi guys
    I am just trying some basic AD scripts, but got some problem with Get-ADGroupMember
    I am trying to get a list of users in a group, including every subgroup in that group. Then I want to display samaccountname, Full Name and group they are in.
    Tried to run some basic command 
    import-module activedirectory
    Get-ADGroupMember "Domain Admins" -recursive | Select-Object Name,samaccountname
    When executed, I get this:
    Get-AdGroupMember : A parameter cannot be found that matches parameter name 'recursive'.
    At E:\scripts\testAD.ps1:2 char:35
    + Get-ADGroupMember "Domain Admins" -recursive | Select-Object Name,samaccountname
    +                                  
    ~~~~~~~~
        + CategoryInfo          : InvalidArgument: (:) [Get-AdGroupMember], ParameterBindingException
        + FullyQualifiedErrorId : NamedParameterNotFound,Get-AdGroupMember
    How do I get it to work? Using PS 3

    Hi,
    I'm not getting the error you do, but you can try the Quest AD powershell module.
    http://www.quest.com/powershell/activeroles-server.aspx
    if((get-pssnapin "Quest.ActiveRoles.ADManagement" -erroraction SilentlyContinue) -eq $null)
      {add-pssnapin "Quest.ActiveRoles.ADManagement"}
    Get-qadgroupmember "domain admins" -indirect | select-object name,samaccountname
    Hope this helps.
    Regards,
    Calin

  • Get-AdGroupMember -recursive doesn't return membership for some nested groups.

    I have the following setup:
    Test Parent Group (Group)
      - John Doe (User)
      - Domain Users (Group, contains 1000s of users)
    When I call: Get-AdGroupMember "Test Parent Group" -recursive
    Only John Doe is returned.
    Thoughts?

    First, it seems that Get-ADGroupMember in a recursive mode does not return object with the class group. So only the actual members are returnd not the groups.
    Second, with the -recursive, Get-ADGroupMember reads the member attribute of each nested groups. Users are not a member of Domain Users through the member attribute but through the primaryGroupID attribute. Thus you list the members of Domain Users if you
    target it directly Get-ADGroupMember -Identity "Domain Users" but not when this one is nested. I don't know if there is a documentation about this.
    Note: Posts are provided “AS IS” without warranty of any kind, either expressed or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose.

Maybe you are looking for