Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Get-ADUser - no code runs after that stage

$
0
0

Hi All.

I am writing a script to send an email to a user.

I have the user login Id but I am going onto AD to get the users email address, my script does a few things and then gets the users email from AD before attempting to send them an email.

What I am noticing is that within my code, any line of code after the lines before fails to execute.

import-module ActiveDirectory

$details = Get-ADUser -identity $owner -Properties * | Select Name, GiveNname, SamAccountName, EmailAddress $email_address = $details.EmailAddress $name = $details.GiveNname


Anything before the 4 lines runs fine, I can print out debug messages etc, but after these 4 lines, nothing runs.

Am I missing something here.


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>