Wed, Jan 12, 2011
The small function below will allow you to get the age of the password of an account on a remote computer:
Function Get-LocalPasswordAge([string]$server,[string]$user)<br /> {<br /> if (($user -ne "") -and ($server -ne "")){[Math]::Round(([ADSI]"WinNT://$server/$user").PasswordAge[0] /86400)}<br /> }
As you can see, the heart of this uses the ADSI provider for PowerShell, which means there aren’t any other cmdlets required.
Wed, Jan 12, 2011
Your mileage will vary on the usefulness of this script, however I wanted to use PowerShell to let me know when a resource we track in Jabber was open. I set the MUC to persistent, and began by finding the latest conversation log file.
$path = Get-ChildItem $env:appData'\.purple\logs\jabber\'$env:userName'\
[email protected]\' | Sort-Object -Property LastWriteTime -Descending | Select-Object -First 1
Next, we get the content and remove the HTML tags with it:
``Your mileage will vary on the usefulness of this script, however I wanted to use PowerShell to let me know when a resource we track in Jabber was open.
Tue, Jan 11, 2011
On a jailbroken iPhone 4 connected to WiFi running MyWi connected to my PC via USB cable, I was able to use my home WiFi connection to connect to the internet on my desktop PC (as opposed to connecting via 3G using MyWi as usual). This would enable me to connect to the internet on my desktop PC using my phone (which doesn’t have a wireless NIC), while not using any of my cellular data plan.
Fri, Dec 31, 2010
The function below can be used to monitor an AD account to see if it’s locked. If it is, it will automatically unlock the account and log it to the screen. I wrote this quickly for a service account that continued to lock, and we used it to keep the account unlocked until the source of the failed logins could be found. As you can see, it does require the Get-QADUser and Unlock-QADUser cmdlets from Quest.
Sat, Dec 4, 2010
The following function will:
Connect to the service that it’s trying to change credentials on through WMI
Change the credentials to those provided when calling the function
Stop the service, wait until the service is stopped (while re-enumerating the service to get up to date WMI information)
… and then start the service again.
If you have any issues with the script, feel free to comment below and I will work to add some error handling or additional functionality.
Wed, Nov 3, 2010
I used the Console project hosted on SourceForge by Marko Bozikovic to embed a Powershell terminal on my Windows 7 Desktop.
Simply remove all the borders, menus, tabs, etc using the settings menu and set a good starting x/y location. Then, you can modify transparency settings to your liking, or just set your desktop and console backgrounds to the same color.
Mon, Sep 20, 2010
Here’s a powershell script to get computer accounts that haven’t logged in for a while:
Get-QADComputer -SearchRoot 'OU=Servers,DC=ad,DC=contoso,DC=com' -IncludeAllProperties| where {$_.pwdLastSet -lt "8/12/2010"} | foreach {Write-host $_.Name $_.pwdLastSet}
Remember – this requires the Powershell Cmdlets from Quest.
Fri, Sep 3, 2010
New iPhone 4 with barely-audible sound through the earpiece? Make sure you remove the protective plastic from the front.
That should do the trick. Don’t ask me how I learned that.
Mon, Aug 30, 2010
After installing Ubuntu (in my case, Netbook edition) on my Acer Aspire One 721, my wired Ethernet connection was not detected.
To resolve, I reinstalled the Atheros drivers for my NIC. If you aren’t sure what type of wired NIC you have, run Terminal and type:
lshw –class network
Once you’ve determined the model of your card, download the installation package from:
http://partner.atheros.com/Download.aspx?id=125
Navigate to the directory the package was placed in, then run these commands in Terminal:
Thu, Aug 12, 2010
When attempting to open a mailbox through OWA, I received the error:
A problem occurred while trying to use your mailbox. Please contact technical support for your organization. To resolve this, in Powershell, I ran the command:
Set-Mailbox User_Name -ApplyMandatoryProperties
Source: http://support.microsoft.com/kb/941146
Note: You may receive an error if the mailbox is located outside your current domain.
Set-Mailbox :The operation could not be performed because object ‘User_Name’ could not be found on domain controller ‘fqdn.