The security is important; working for a huge company sometimes causes problems. You get less right, because of the security. If you a normal user, and you would like to check if one of the user enabled for OCS without Admin rights or Universal Server Administrator right. A normal domain user can check it, because the AD readable for all AD users.
Filedialog and Powershell
When I ask any input from a user in Powershell script most of the time I ask it in a parameter of the script body or just prompt for it during runtime. But with the underlying .NET Framework you can take advantage of the GUI, for example using a dialog panel. By using a dialog to specify a file you can be sure, that there is no spelling mistake in the path and you also provide a better user experience.
That’s a simple one but good to have
$file = “MYFILE.TXT”
$smtpServer = “MYSMTPSERVER.EMAIL.CO.UK”
$msg = new-object Net.Mail.MailMessage
$att = new-object Net.Mail.Attachment($file)
$smtp = new-object Net.Mail.SmtpClient($smtpServer)
$msg.From = “FROMME@EMAIL.CO.UK“ #reply-to-address
$msg.Sender = “Csoma Ádám” #From field
$msg.To.Add(“TOME@EMAIL.CO.UK“) #send-to part
$msg.Subject = “MY SUBJECT”
$msg.Body = “MY TEXT FOR THE EMAIL”
# To authentaicate at the mail server you need to use the next line
# $smtp.Credentials =[System.Net.CredentialCache]::DefaultCredentials
This is not a fairy tale at all just think on the regional settings…
Issue: Get data from a cell
First of all for this exmample an excel application should be installed to the machine. So here are some lines to get the data from a sheet (A1 cell)
Another quest in Sharepoint automatization is to get the selected values for a given multiselect field. We could start in the usual way as to get the given item from the list then check the field value.
I would like to show how-to work with events under Applications and Services Logs using Powershell. For this, my examples use IIS Logging and tracing events. You can find out more in this article: http://blogs.iis.net/webtopics/archive/2010/03/19/iis-7-5-how-to-enable-iis-configuration-auditing.aspx
Sometimes I have to work with event logs under the Applications and Services Logs folder, which stores logfiles grouped by particular component of the system. By default it contains 4 categories with 4 logs:
The Outlook 2010 and the Lync 2010 has a fancy feature that shows the picture of the users, which stored in the Active Directory. The Exchange 2010 introduces the thumbnailPhoto attribute for the User objects that can contain the photo. There are multiple ways to import pictures into the AD; one of the easiest is the Import-RecipientDataProperty Exchange commandlet, but what can we do if we have not installed the Exchange 2010? There are several 3rd party applications available for picture uploading, but if I need to do something more than twice, I automate it. In this reason I chose a PowerShell script, which easily schedulable. In my previous article I wrote about the picture modification. That was the prerequisite of the user pictures that stored into the Active Directory. It is easy to import and export pictures with PowerShell.
What can we do if we need to resize, crop more than 2000 picture? Later it needs to repeat this task regularly, as a scheduled task. The answer is automatizing with PowerShell on Windows OS. I don’t like add-ons or 3rd party things importing into a corporate environment. I decided to write my code without any 3rd party things.
Theoretically all administrators regularly clean up the unused accounts form their environment, so an audit is not problem for them. What if I have more than 3000 servers? It is a huge problem for me, without automation. So in this article you can read about joined loop optimization, because sometimes the joined for loop is time-consuming. The fact is true – many a little makes a mickle.
In my last post i wrote about how to run a powershell script block in the background. It could happen that this script block should be run by another account. Such a case could be that we are running our Powershell script using an normal windows user account but the given script block which installs something intersting to the given machine needs administrator privileges to be successfull.