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

Help with logging

$
0
0

Guys,  Im pretty new to powershell.  I guess I have never had to use it much when it comes to writing my own scripts.  However the time has come.  I am trying to set up a script to enable all my users in a particular OU for Lync.  This is what I have so far.  I know I'm missing something to actually write the info from the enable-csuser cmdlet to the log file.  

I would like to log what users where enabled and also any errors it runs into.   I guess its time to take a powershell class.

Is anyone willing to help?

$Logfile = "P:\logs\enuser.txt"


import-module Lync
import-module activedirectory 
get-csaduser -filter {Enabled -ne $True} -OU "OU=FacultyStaff,OU=Accounts,DC=letnet,DC=net" | Enable-CsUser -RegistrarPool LyncPool13.letnet.net -SipAddressType EmailAddress 
Function LogWrite
{
    Param ([string]$logstring)
    Add-Content $Logfile -Value $logstring
}
LogWrite


Dusty


Viewing all articles
Browse latest Browse all 21975

Trending Articles