Search found 187 matches

by ITEngineer
Mon Feb 17, 2020 9:21 pm
Forum: Windows PowerShell
Topic: Calling Powershell Function inside the Add-Member -InputObject ForEach loop?
Replies: 3
Views: 207

Calling Powershell Function inside the Add-Member -InputObject ForEach loop?

People, I wonder if anyone here can assist in integrating the below function to Get Last Logon Time in Exchange Online mailbox with the simple script I have put together? The main script that is already working to collect mailbox size statistics then output to Out-Gridview: Write-Host "Gathering Sta...
by ITEngineer
Mon Feb 17, 2020 9:15 pm
Forum: Windows PowerShell
Topic: Need some help in Try Catch error handling inside calculated properties?
Replies: 4
Views: 182

Re: Need some help in Try Catch error handling inside calculated properties?

jvierra wrote:
Mon Feb 17, 2020 8:47 pm
The @ is only for splats. Remove it.
LOL, yes, that was great finding :-)
:D

Thanks Mr. Vierra.
by ITEngineer
Mon Feb 17, 2020 6:42 pm
Forum: Windows PowerShell
Topic: Need some help in Try Catch error handling inside calculated properties?
Replies: 4
Views: 182

Re: Need some help in Try Catch error handling inside calculated properties?

Yes, you are right, so how to fix that issue?

If the Department has some values in it, then it will not returns error.
But if it is empty, just skip it and move on to the next Attributes / properties.
by ITEngineer
Mon Feb 17, 2020 5:30 pm
Forum: Windows PowerShell
Topic: Need some help in Try Catch error handling inside calculated properties?
Replies: 4
Views: 182

Need some help in Try Catch error handling inside calculated properties?

Hi Folks, I need some help in creating the Try Catch Block inside the Calculated properties. The below code to show the duplicated AD attributes working fine: Get-ADUser -Filter { (Enabled -eq $True) -and (extensionAttribute1 -like "*") -and (extensionAttribute2 -like "*") } -SearchBase "DC=domain,D...
by ITEngineer
Thu Feb 06, 2020 2:24 am
Forum: Windows PowerShell
Topic: Displaying AD groups where a user account is member of?
Replies: 7
Views: 574

Re: Displaying AD groups where a user account is member of?

OK, what I wanted to achieve is the script to display the AD group, where:
$users = Get-ADUser -Filter {(Name -like "*Administrator*")}

is member of, from these list of AD groups:
$groups = 'IT Team', 'Production Access', 'Global DL', 'Local Admins'
by ITEngineer
Thu Feb 06, 2020 2:13 am
Forum: Windows PowerShell
Topic: Displaying AD groups where a user account is member of?
Replies: 7
Views: 574

Re: Displaying AD groups where a user account is member of?

To get a canonical name just reference it in your Get". Get-ADUser -Filter "Name -like '*Administrator*'" -Property CanonicalName OK, that does make sense. @{n = 'MemberOf'; e = { $_.SideIndicator -eq '==' } } | Format-Table -AutoSize Is there any reason why that section above always displaying fal...
by ITEngineer
Wed Feb 05, 2020 9:28 pm
Forum: Windows PowerShell
Topic: Displaying AD groups where a user account is member of?
Replies: 7
Views: 574

Displaying AD groups where a user account is member of?

People, I need someone to assist in fixing the logic in my current script below where it should show MemberOf = Yes or True for specific name patterns that is Member of specific sets of AD groups: function Get-CanonicalName ([string[]]$DistinguishedName) { foreach ($dn in $DistinguishedName) { $d = ...
by ITEngineer
Mon Feb 03, 2020 8:56 pm
Forum: Windows PowerShell
Topic: Exporting non VMware computer from AD Online computer list as .CSV?
Replies: 8
Views: 662

Re: Exporting non VMware computer from AD Online computer list as .CSV?

Add them to the properties of the select. Already change it like this: $adprops = @( 'IPv4Address', 'OperatingSystem', 'OperatingSystemVersion', 'lastLogondate' ) $properties = @( 'Name', 'OperatingSystem', 'OperatingSystemVersion', 'LastLogonDate', 'Ipv4Address' ) $filter = { (Enabled -eq $true) -...