Search found 138 matches

by ITEngineer
Mon Mar 18, 2019 9:18 pm
Forum: Windows PowerShell
Topic: Unable to call Function to parse the string from AD result
Replies: 4
Views: 727

Re: Unable to call Function to parse the string from AD result

The result is still an error? #Get Active Directory information for current user $sysInfo = New-Object -ComObject 'ADSystemInfo' $userDN = $sysInfo.GetType().InvokeMember('UserName', 'GetProperty', $null, $sysInfo, $null) $adUser = [ADSI]"LDAP://$($userDN)" [void][Runtime.InteropServices.Marshal]::F...
by ITEngineer
Mon Mar 18, 2019 9:03 pm
Forum: Windows PowerShell
Topic: Unable to call Function to parse the string from AD result
Replies: 4
Views: 727

Re: Unable to call Function to parse the string from AD result

jvierra wrote:
Mon Mar 18, 2019 8:56 pm
How to format a telephone number:


$n = '2123346789'
'({0}){1}-{2}' -f $n.SubString(0,3),$n.Substring(3,3),$n.SubString(6,4)
That's good to know,

so how can I store that formatted number into a variable called $Formatted ?
by ITEngineer
Mon Mar 18, 2019 8:21 pm
Forum: Windows PowerShell
Topic: Unable to call Function to parse the string from AD result
Replies: 4
Views: 727

Unable to call Function to parse the string from AD result

I'm unable to call Function to parse the string from AD result using 10x different combination like below? Function Format-TelephoneNumber { Param ( [Parameter(ValueFromPipeline = $true, Position = 0)] [Alias('Number')] [string]$TelephoneNumber, [Parameter(Position = 1)] [string]$DefaultCountryCode ...
by ITEngineer
Thu Mar 14, 2019 9:42 pm
Forum: Windows PowerShell
Topic: Fixing PowerShell script to find AD user account based on Display Name or First.LastName?
Replies: 2
Views: 686

Re: Fixing PowerShell script to find AD user account based on Display Name or First.LastName?

jvierra wrote:
Thu Mar 14, 2019 5:38 am
Get-ADUser -Filter "Surname -eq '$lastName' -and GivenName -eq '$firstname'"
Hm.. yes, that does make sense.
let me integrate to my script.
by ITEngineer
Thu Mar 14, 2019 5:19 am
Forum: Windows PowerShell
Topic: Fixing PowerShell script to find AD user account based on Display Name or First.LastName?
Replies: 2
Views: 686

Fixing PowerShell script to find AD user account based on Display Name or First.LastName?

Hello All, I need some help in fixing the below PowerShell script to search for user samAccountName or Alias or Display Name like First Lastname in Active Directory from input typed by the user: Do { Write-Host -Object 'Enter a samaccountname / Alias or even "First Lastname", or nothing (Press Enter...
by ITEngineer
Thu Feb 28, 2019 4:44 am
Forum: Windows PowerShell
Topic: Exporting Exchange server mailbox information as .CSV so I can import.CSV as Mail-Contact?
Replies: 1
Views: 669

Exporting Exchange server mailbox information as .CSV so I can import.CSV as Mail-Contact?

People, I need to export the sister company Exchange Server mailbox attributes as .CSV, So I can run it on the new Exchange Server OnPremise using the script below: Import-Csv "C:\contacts.csv" | foreach {Set-Contact $_.externalemailaddress -Name $_.name -FirstName $_.firstname -LastName $_.lastname...
by ITEngineer
Mon Feb 18, 2019 2:59 pm
Forum: Windows PowerShell
Topic: Query OnPremise AD for Specific AD attributes not working?
Replies: 1
Views: 436

Query OnPremise AD for Specific AD attributes not working?

Hi People, I need some help to modify the below script to show additional column Office 365 or OnPremise: Get-ADGroup -Filter {Name -like '*IT*'} | Select-Object @{ n='Group'; e={ $_.Name } }, @{ n='Members'; e={ (Get-ADGroup $_.DistinguishedName -Properties Members | Select-Object Members).Members ...
by ITEngineer
Sun Feb 10, 2019 4:56 pm
Forum: Windows PowerShell
Topic: Invoke-Command not working for executing another script using UNCPath?
Replies: 3
Views: 576

Re: Invoke-Command not working for executing another script using UNCPath?

jvierra wrote:
Fri Feb 08, 2019 12:24 am
"Second hop restriction" You cannot access a third computer from a remote session.
OK, so how to make it working?
by ITEngineer
Thu Feb 07, 2019 11:27 pm
Forum: Windows PowerShell
Topic: Invoke-Command not working for executing another script using UNCPath?
Replies: 3
Views: 576

Invoke-Command not working for executing another script using UNCPath?

Hi All People, I need some help to execute the Batch script remotely using Invoke-Command but still failed numerous times. I have executed the PowerShell ISE from my local workstation as Administrator and my user account is the member of Enterprise Administrator and Domain Admins group. When I try t...
by ITEngineer
Thu Feb 07, 2019 4:23 pm
Forum: Windows PowerShell
Topic: Unable to export the result to .CSV file ?
Replies: 3
Views: 610

Re: Unable to export the result to .CSV file ?

$CsvFile = 'C:\Result.csv' $key = 'SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\Results\Install' $OUList = @( 'OU=TEST Servers,OU=MyDomain Testing,DC=MyDomain,DC=com' 'OU=PROD Servers,OU=Servers,OU=MyDomain Sydney,DC=MyDomain,DC=com' 'OU=PROD Servers,OU=Servers,OU=New Company...