Arposh Windows System Administration tool 2.0 (AWSA)

Download AWSA 2.0


New in v2.0:
  • Compatibility with Windows servers
  • Many pre-requisities removed
  • Customization of results via XML file
  • Built-in search function
  • View services of remote computers
  • Send messages to computers remotely
  • Context menus
  • Performance has been enhanced greatly
  • Ability to add local administrators

ACSA Requirements:
- Powershell v2 or greater

Features:
  • Connects to currently logged-in domain on startup or domain set in XML file
  • Search for PC - Search Active Directory for computers matching the string in the textbox
  • System Info - Gathers info about PC, user session, make/model, hardware, OS, and networking
  • Local Admins - Enumerates local administrators and allows you to add or remove them
  • Applications - Enumerates installed software and allows you to uninstall
  • Startup Items - Enumerates startup items and allows you to remove them
  • Processes - Enumerates running processes and allows you to kill them
  • Services - Enumerates services
  • Remote Desktop - Remote desktop into computer
  • Remote Assistance - Initiate remote assistance session with remote computer
  • View C Drive - Opens explorer to the C drive of remote computer
  • Send Message - Sends a message to all users on remote computer
  • Restart Computer - Restarts remote computer (Includes confirmation)
  • File Menu
    • Connect to domain... - Connect to a different domain
  • View Menu
    • View WSUS logs
    • View Event Viewer
    • View Services
    • View Local Users/Groups MMC

Usage: Download AWSA.zip and unblock the file (Right-click, Properties and unblock). Unzip AWSA.zip and open the AWSA.Options.xml file in Notepad to modify any settings.  To use the GUI, right-click the AWSA.ps1 script and select 'Run with PowerShell'.  Once the GUI loads, type in a partial computer name to search for it in Active Directory.  Right-click on a computer in the listbox and select it to move the name into the textbox.  If you already know the name of the computer you would like to manage remotely, you can type that directly into the textbox.

Download AWSA 2.0

Tweet Tips of the Week 12/04-12/10

Every now and then I like to tweet some quick tips or short commands that can be useful for System Administrators.  Here are some of my recent tweets:

12/08 - Remoted into a machine and can't find the Restart option? Use 'Shutdown /f /r /t 00' to force a reboot immediately.

12/07 - PowerShell network scanner - 1..254 | %{test-connection 192.168.1.$_ -count 1 | Select Destination,IPV4Address} 

12/06 - Enable/Disable the opening of multiple Outlook windows with a switch by changing your shortcut to 'Outlook.exe /recycle'.

12/05 - Want to use a GUI to shut down large a number of machines? Use 'shutdown /i' and you will be presented with a shutdown GUI.

12/04 - Don't have installed for WMI queries? No worries, use WMIC. 'wmic OS get Version'.

Arposh New User Creation (ANUC)

[Updated - May 13, 2012]


Download link: Arposh New User Creation v1.1

One task that every systems administrator has to go through at some point is the creation of new user accounts.  Over time, this becomes burdensome and tedious.  The Active Directory wizard takes you through multiple screens and you have to enter the same information multiple times in some occasions (e.g. a lot of organizations use FirstName.LastName for samAccountNames).  It also does not allow you to set all of the fields that you want included in the wizard.  I wanted a way to include those fields and an option to set defaults for some fields.  Luckily Powershell makes all of that possible in an easy to use way.  Powershell does all of the heavy lifting and an optional XML file saves even more time by pre-populating certain fields and setting defaults.  You also have the ability of bulk-adding users via CSV.  To create users from a CSV, click on File > CSV Mode.  You can then import the CSV and browse through the users in the CSV.  Once the CSV is imported, you can create one user at a time or all at once.  If you want a CSV template created for you, click on File > Create CSV Template.

ANUC Requirements:
- Powershell v2 (Minimum)
- ActiveDirectory module

Usage: Download the ANUC.zip file from the TechNet ScriptCenter and extract it into any directory.  Right-click on ANUC.ps1 and select 'Run with PowerShell'.  To modify the available options for drop-down lists and default entries, edit the ANUC.Options.XML file. To create users from a CSV, click on File > CSV Mode.  You can then import the CSV and browse through the users in the CSV.  Once the CSV is imported, you can create one user at a time or all at once.

Features:
  • Allows user creation with oft-used Active Directory attributes
  • Bulk creation of users from CSV
  • Auto-generation of account attributes based on other attributes
    • Display Name
    • samAccountName
    • userPrincipalName
  • Default entries
    • Domain
    • OU
    • Phone Number (can use full number or company prefix '212-555-')
    • Department
    • Company
    • Description
    • Password (Accounts are set to change at first logon)
    • Site (HQ, Branch Office 1, etc)
    • Street Address
    • City
    • State
    • Postal Code
  • Pre-populated fields for easy selection
    • Address information
    • Domains
    • OUs
    • Descriptions
    • Departments

Single-User Mode

CSV Mode

Inventorying vSphere VMs with custom attributes

I'm somewhat new to working with VMware's vSphere and have been teaching it to myself through Powershell.  Powershell has the advantage of being able to explore objects without having to worry about accidentally clicking on something that could take the environment down.  To stay as safe as possible, I started out with exploring the Get commands, the most obvious being Get-VM.  My first script was as basic as they get.

Get-VM 'myvm' | Format-List *

This gave me a basic list of properties that I could view.  Now I needed a way to store that information in a report.

Get-VM 'myvm' | Select Name,NumCPU,MemoryMB,UsedSpaceGB,Notes | Export-CSV C:\myVMs.csv

My new CSV was a good start, but there was other information that I wanted to capture.  I started digging into the objects nested deep in the VM and started creating my own properties.  The one-liner started to stretch a bit far, so I cleaned it up by breaking the lines at the pipes.

Get-VM 'myvm' | 
Add-Member -Name "GuestOS" -Value {$this.ExtensionData.Guest.GuestFullName} -MemberType ScriptProperty -Passthru -Force | 
Add-Member -Name "VMToolsVer" -Value {$this.extensiondata.config.tools.toolsversion} -MemberType ScriptProperty -Passthru -Force | 
Select Name,NumCPU,MemoryMB,UsedSpaceGB,GuestOS,IPv4Address,Notes |
Export-Csv C:\myVMs.csv

Now we're getting somewhere.  Almost any information that was built into the vSphere console and viewable was in my grasp.  While I was searching the internet for more things I could add, I came across a post from @LucD22 about custom attributes.  There were a few posts about creating and setting custom attributes, but no easy way to retrieve them that I could find.  So I set out to write my own.  This was my first attempt at gathering the information.

Get-VM 'myvm' | Select Name,@{l="Contact";e={$_.customfields | ?{$_.key -eq 'Contact'} | select -ExpandProperty value}}

The more I learn about Powershell, the more I become a stickler for standardization and I didn't like the look of that hash table when I added it into my previous script; it cluttered my Select-Object statement and made it harder to read which attributes I was pulling.  Once I cleaned up the script, I turned it into a function and it was ready for production.  Below is the final version of the script with help included.

Function Get-VMReport {
<#
.SYNOPSIS
Retrieves virtual machines from VMware vCenter
.DESCRIPTION
Retrieves virtual machines from VMware vCenter and returns summary information
.EXAMPLE
.\Get-VMReport.ps1
This returns all virtual machines from all default vCenters
.EXAMPLE
.\Get-VMReport.ps1 -vCenter vCenter01 -Credential $Credential
This returns all virtual machines from vCenter01 using the credentials stored in $Credentials
.LINK
http://blog.richprescott.com
#>

[CmdletBinding()]
    Param(
    [String[]]$vCenter = 'MyvCenter',
    
    [Parameter(Mandatory=$true,ParameterSetName="RunAs")]
    [Alias("PSCredential")]
    [System.Management.Automation.PSCredential]$Credential
    )

Connect-VIServer -Server $vCenter -Credential $Credential | Out-Null
Get-VM | 
    Add-Member -Name "vCenter" -Value {$vCenter} -MemberType ScriptProperty -Passthru -Force | 
    Add-Member -Name "IPv4Address" -Value {$this.ExtensionData.Guest.IPAddress} -MemberType ScriptProperty -Passthru -Force | 
    Add-Member -Name "GuestOS" -Value {$this.ExtensionData.Guest.GuestFullName} -MemberType ScriptProperty -Passthru -Force | 
    Add-Member -Name "Datastore" -Value {Get-Datastore -VM $this} -MemberType ScriptProperty -Passthru -Force | 
    Add-Member -Name "VMToolsVer" -Value {$this.extensiondata.config.tools.toolsversion} -MemberType ScriptProperty -Passthru -Force | 
    Add-Member -Name "Contact" -Value {$this.customfields | ?{$_.key -eq 'Contact'} | select -ExpandProperty value} -MemberType ScriptProperty -Passthru -Force | 
    Select vCenter,Name,Contact,PowerState,VMToolsVer,GuestOS,numCPU,MemoryMB,Datastore,UsedSpaceGB,ProvisionedSpaceGB,IPv4Address,Notes
Disconnect-VIServer -Server $vCenter -confirm:$False | Out-Null
}
Get-VMReport | Export-Csv C:\Reports\vCenter.csv -NoTypeInformation