Search found 216 matches

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

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 "Gatherin...
by ITEngineer
Mon Feb 17, 2020 8:15 pm
Forum: PowerShell
Topic: Need some help in Try Catch error handling inside calculated properties?
Replies: 4
Views: 3052

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

jvierra wrote: Mon Feb 17, 2020 7: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 5:42 pm
Forum: PowerShell
Topic: Need some help in Try Catch error handling inside calculated properties?
Replies: 4
Views: 3052

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 4:30 pm
Forum: PowerShell
Topic: Need some help in Try Catch error handling inside calculated properties?
Replies: 4
Views: 3052

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 "*") } -Sea...
by ITEngineer
Thu Feb 06, 2020 1:24 am
Forum: PowerShell
Topic: Displaying AD groups where a user account is member of?
Replies: 7
Views: 5133

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 1:13 am
Forum: PowerShell
Topic: Displaying AD groups where a user account is member of?
Replies: 7
Views: 5133

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...
by ITEngineer
Wed Feb 05, 2020 8:28 pm
Forum: PowerShell
Topic: Displaying AD groups where a user account is member of?
Replies: 7
Views: 5133

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 7:56 pm
Forum: PowerShell
Topic: Exporting non VMware computer from AD Online computer list as .CSV?
Replies: 8
Views: 4399

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) -...
by ITEngineer
Mon Feb 03, 2020 7:38 pm
Forum: PowerShell
Topic: Exporting non VMware computer from AD Online computer list as .CSV?
Replies: 8
Views: 4399

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

Mr Vierra, thank you for the pointer in this matter. How do I include the column to show the ComputerModel & the LoggedOn user account? $adprops = @( 'IPv4Address', 'OperatingSystem', 'OperatingSystemVersion', 'lastLogondate' ) $properties = @( 'Name', 'OperatingSystem', 'OperatingSystemVersion'...