I want to make sure that all users in a specific OU in my mikefrobbins.com Active Directory domain have the "Deny this user permissions to log on to Remote Desktop Session Host server" option set (checked): Download the Quest Active Directory PowerShell Snapin (free). The PowerShell command shown below searches this specific OU in my Active Directory domain for users where this attribute is not equal to false. The default setting is blank (allowed) as shown with the Gill Bates user below. Read more [...]
Want to rename an IIS Web Application on a Windows 2008 R2 server? It's not possible from the GUI, but it's simple to accomplish using PowerShell. First, let's create a web application in an existing website and then verify it exists:
Here it is in the GUI: Rename the web application using PowerShell and then verify it was renamed:
New-Item -ItemType Directory -Path d:\iis\robbinsapps
New-WebApplication -Name RobbinsApps -Site MikeFRobbins -PhysicalPath d:\iis\robbinsapps -ApplicationPool "ASP.NET v4.0"
Here it is again in the GUI showing that it has indeed been renamed: µ Read more [...]
Rename-Item 'IIS:\Sites\MikeFRobbins\RobbinsApps' 'RobbinsApps-Archive'
On a Windows Server 2008 R2 machine, IIS has already been installed and you want to create an additional website. If necessary, an additional IP Address has been added to the server also. Use the New-Website PowerShell cmdlet to accomplish this task:
You can get a list of websites running on the server by using the Get-Website cmdlet or by running Get-ChildItem on the IIS PSDrive: µ Read more [...]
New-Item -type directory -path d:\iis\mikefrobbins
New-Website -Name "mikefrobbins" -Port 80 -IPAddress "192.168.1.222" -PhysicalPath d:\iis\mikefrobbins -ApplicationPool "ASP.NET v4.0"
I received an email recently stating that I hadn't downloaded the most recent version of firmware for multiple EqualLogic Storage Area Networks that I support. What's the easiest way to check what firmware version an EqualLogic SAN is running? PowerShell of Course! You'll need the EqlPSTools PowerShell Module which is part of the EqualLogic Host Integration Tools (HIT) kit for Microsoft that can be downloaded from the EqualLogic support site. Once this module has been installed, you'll be able Read more [...]
The latest version of Backup Exec, version 2012 adds support for PowerShell. When Backup Exec 2012 is installed, it adds a PowerShell module named "BEMCLI": You'll need the .NET Framework 3.5.1 installed to be able to import this module: I'm guessing this .NET Framework 3.5.1 issue is an oversight since the typical installation installs the .NET Framework 4.0, but doesn't enable 3.5.1: Enable the NET-Framework-Core Windows Feature. You'll have to import the server manager module (Import-Module Read more [...]
As with most things in IT, the answer is that it depends. It depends on whether or not the server was installed with the Full Installation or with the Server Core Installation. It also depends on what your definition of installed is. If the server was installed with the Full Installation (GUI) then PowerShell is installed (enabled) by default, but if it was installed using the Server Core Installation (no GUI) then PowerShell is not installed (not enabled) by default. If you attempt to Read more [...]
The EqualLogic Host Integration Tool kit for Microsoft version 4.0.0 adds 12 additional PowerShell cmdlets to the 55 that existed in version 3.5.1 for a total of 67 cmdlets. The release notes state that firmware version 4.2.0 or later is required for the HIT kit v4.0.0 PowerShell tools. The syntax of several of the existing cmdlets also changed which appears to be mostly the addition of new parameters. See the release notes which are included as part of the new HIT kit that can be downloaded from Read more [...]
I recently ran into an issue when trying to access one of my Web Servers with PowerShell remoting. Here's a simple test to show the error: My first thought was that PowerShell remoting wasn't enabled on the target computer. So let's try to run this without remoting: No luck with using that route either. I headed over to the web server and ran the Enable-PSRemoting Cmdlet and received another error: "Set-WSManQuickConfig : The client cannot connect to the destination specified in the request. Read more [...]
This past weekend I posted a blog about Beginner Event #9 of the 2012 PowerShell Scripting Games and I received a comment on it from @ruddawg26. I took a look at his profile and tweets. I found a tweet that was tweeted by him "Interesting how people are claiming to have same beginner 1 solution as the expert solution but still did not get 5 stars #2012SG" so I decided to investigate further which is how this blog came to be. There's a blog article on the Hey, Scripting Guy! blog: "Expert Commentary: Read more [...]
The details of the event scenario and the design points for Beginner Event #10 of the 2012 PowerShell Scripting Games can be found on the “Hey, Scripting Guys! Blog”. Gather all of the counter information for the processor counter set. Take three separate readings at five second intervals. This information should be appended to a single text file named servername_ProcessorCounters.txt in the Documents special folder. You'll lose points for complexity. Use native PowerShell commands where possible. This Read more [...]
The details of the event scenario and the design points for Beginner Event #9 of the 2012 PowerShell Scripting Games can be found on the “Hey, Scripting Guys! Blog”. Find Veto Shutdown Events in the Application Event Log. A screenshot was provided that contains EventID 10001 and Winsrv as the source. Write a one liner to display the date of occurrence and the application name. Your command should be efficient. Complexity will cost you points. As noted in the comments section of this scenario, Read more [...]
The details of the event scenario and the design points for Beginner Event #8 of the 2012 PowerShell Scripting Games can be found on the “Hey, Scripting Guys! Blog”. Write a script to determine if a computer is a laptop or a desktop from a hardware prospective and display the output on the console. If this requires admin rights, you should detect if it is running as an admin or standard user. Extra points for writing a simple function that returns a boolean. I kind of figured this was going Read more [...]
The details of the event scenario and the design points for Beginner Event #7 of the 2012 PowerShell Scripting Games can be found on the “Hey, Scripting Guys! Blog”. Display a list of enabled logs that contain data. Do not display errors. Include hidden logs. Display the complete log name and number of entries. Sort by the logs with the most entries in them. My research on this one lead me to the "Use PowerShell to Query All Event Logs for Recent Events" blog article on the Hey, Scripting Read more [...]
The details of the event scenario and the design points for Beginner Event #6 of the 2012 PowerShell Scripting Games can be found on the “Hey, Scripting Guys! Blog”. Write a PowerShell script to determine the uptime of servers by using the WMI class WMI32_OperatingSystem. The script should display the server name, how many days, hours, and minutes the server has been up. As usual, I started out by running Get-Help Get-WMIObject to determine what the available parameters were for this Read more [...]
The details of the event scenario and the design points for Beginner Event #5 of the 2012 PowerShell Scripting Games can be found on the “Hey, Scripting Guys! Blog”. Your manager has task you with producing a report of applications that are causing errors on your servers. This report should display the source and number of errors from the application log. How can I find out what PowerShell cmdlets are available to query the application event log? I could certainly use Get-Help, but I Read more [...]
The details of the event scenario and the design points for Beginner Event #4 of the 2012 PowerShell Scripting Games can be found on the “Hey, Scripting Guys! Blog”. The key to this one is figuring out how to format the output as shown in the screen shot in the event scenario which is similar to the one in the image below: The PowerShell Down Under guys posted some great prep videos leading up to the beginning of the scripting games and one of them titled "Scripting Games 2012 - Working Read more [...]