A simple powershell function

Today, I’d like to share a very simple function I wrote some years ago, I would even say many years :). This is a simple powershell function, without any error handling and parameters checking. I needed at some point to have proper logging of my scripts and I wanted to have it displayed on screen and logged to the file as well for some later usage. I wrote this function to achieve my need.

Continue reading

Case Study : Windows 2012 R2 – ping internally returns wrong IP on multihomed server

As system engineer I’m providing a 3rd level support in IT areas I work on. So one day a strange case came to me.  An issue was reported that on multi-homed Windows 2012 R2 server – this case was : 2 network interfaces on Windows 2012 R2 (I can imagine it can happen on 2+ network interfaces Windows 2008 or newer). So on mutlihomed Windows Server 2012 R2, when try to ping internally FQDN wrong IP is returned. Continue reading

Windows Server 2012 – WinRM Corrupt or Missing – in case you want to be too secure

Recently when I tried to add some features in Windows 2012 R2 using server manager I received this error : Failed to open the runspace pool. The Server Manager WinRM plug-in might be corrupted or missing.

I started to search for help and one of the posts I found was http://www.lukebrowning.com/sysadmin/windows/windows-server-2012-winrm-corrupt-or-missing/ – so maybe solution presented there is working – I don’t know for me it’s not. Continue reading

How to downlaod files from the web (through proxy) using powershell

Today I had to download around 900 files from ftp server, however firewall was blocking almost everything, however I was able to access the FTP server via web browser (I used one and only IE :)). So a colleague advised me to use wget to download the files, but I’m a kind of MS guy and I’m not get used to using wget, so I decided to use powershell. So I’d like to present you how easy it is to download the files using powershell (I’m  using v.2). Continue reading

Windows netsh commands for required ports for vCenter Server 5.5 in Windows

This post is for a lazy administrators. Recently I had to install vCenter and its components. Part of it is opening the proper firewall ports in Windows firewall. The list of required ports for vCenter Server 5.5 can be found on this VMWare site. However it’s just a table containing all the ports required for the specific vCenter Server component. I run a quick google search for windows netsh commands to create the firewall rules for the specific vCenter role/component, but I didn’t find it, so I decided, to save any other lazy admin some time. Below you can find them in the vCenter Server role/component installation order.

Continue reading

httperr.log – just another IIS log ?

Recently a friend reminded me few cases, we were analyzing, while I was working as messaging engineer. We had problems with an application, which was using EWS (Exchange Web Service), trying to get free/busy information from exchange. Then IIS was becoming unresponsive and the only thing we could do was IIS reset. So we used “httperr.log” for the analysis and issue detection. Probably not many of you heard about it, but this log is really useful with issues related to web server.

Continue reading

Get-ADUser : A referral was returned from the server

Recently a friend of mine had to query for the users and user properties who are members of “Enterprise Admins” Active Directory group. Of course you need to import ActiveDirectory powershell module to run it. The command is pretty simple

So command should prepare a csv file with all the users and their properties, even if users are members of nested groups. However a strange error we’ve received.
.
Continue reading

HOWTO : Find all users in Active Directory who haven’t logged in longer than 90 days

powershell-icon-152-191890Here comes another howto. I was asked few times to find users that haven’t logged to the domain for a defined amount of time, that I decided write few words how to handle it. The easiest way to achieve that is use of “Saved Queries” in Active Directory Users and Computers console. To do that you simply right-click on the “Saved Queries”, choose New->Query

AD0

Then you simply type the name of the query, you can also define specific OU for that and click define query. In the common queries, in the bottom you can choose to find users who has not logged on for some amount of time, counted in days.

ad2

It’s the easiest way to find the users … However I would like to have a list in let say CSV file. Here comes the powershell … again. Continue reading