hello,<\/p>\n
I have this script to extract details of users and one of the things i need is the security owner of these users. I know this is part of ACL but how can i add it to my script?<\/p>\n
$Days = Read-Host \"Enter the number of days to extract\"\n$Time = (Get-Date).Adddays(-($Days))\nGet-ADUser -server \"domain.com\" -Filter * -Property whenCreated, proxyaddresses, SamAccountName, PasswordLastSet, extensionAttribute1, extensionAttribute3, extensionAttribute15, extensionAttribute14, msExchHideFromAddressLists, Mail, Country, countrycode, canonicalname, msNPAllowDialin, info, enabled, AccountExpirationDate |\n Where {$_.whenCreated -gt $Time} |\n Select Name, @{L = \"ProxyAddresses\"; E = { ($_.ProxyAddresses -match '^') -join \";\"}}, SamAccountName, whenCreated, UserPrincipalName, PasswordLastSet, extensionAttribute1, extensionAttribute3, extensionAttribute15, extensionAttribute14, msExchHideFromAddressLists, Mail, Country, countrycode, canonicalname, msNPAllowDialin, info, enabled, AccountExpirationDate |\n export-csv newaccounts.csv -NoTypeInformation\n<\/code><\/pre>","upvoteCount":2,"answerCount":12,"datePublished":"2021-10-14T13:54:27.000Z","author":{"@type":"Person","name":"spiceuser-r9zyv","url":"https://community.spiceworks.com/u/spiceuser-r9zyv"},"suggestedAnswer":[{"@type":"Answer","text":"
Advertisement
hello,<\/p>\n
I have this script to extract details of users and one of the things i need is the security owner of these users. I know this is part of ACL but how can i add it to my script?<\/p>\n
$Days = Read-Host \"Enter the number of days to extract\"\n$Time = (Get-Date).Adddays(-($Days))\nGet-ADUser -server \"domain.com\" -Filter * -Property whenCreated, proxyaddresses, SamAccountName, PasswordLastSet, extensionAttribute1, extensionAttribute3, extensionAttribute15, extensionAttribute14, msExchHideFromAddressLists, Mail, Country, countrycode, canonicalname, msNPAllowDialin, info, enabled, AccountExpirationDate |\n Where {$_.whenCreated -gt $Time} |\n Select Name, @{L = \"ProxyAddresses\"; E = { ($_.ProxyAddresses -match '^') -join \";\"}}, SamAccountName, whenCreated, UserPrincipalName, PasswordLastSet, extensionAttribute1, extensionAttribute3, extensionAttribute15, extensionAttribute14, msExchHideFromAddressLists, Mail, Country, countrycode, canonicalname, msNPAllowDialin, info, enabled, AccountExpirationDate |\n export-csv newaccounts.csv -NoTypeInformation\n<\/code><\/pre>","upvoteCount":2,"datePublished":"2021-10-14T13:54:27.000Z","url":"https://community.spiceworks.com/t/extract-the-owner-under-security-of-a-user/814035/1","author":{"@type":"Person","name":"spiceuser-r9zyv","url":"https://community.spiceworks.com/u/spiceuser-r9zyv"}},{"@type":"Answer","text":"Welcome<\/p>\n
If you post code, please use the ‘Insert Code’ button. Please and thank you!<\/p>\n