Powershell first and last day of this month and last

$CURRENTDATE=GET-DATE -Format “MM/dd/yyyy”



SendKeys With VBScript


‘VBScript Example
Set WshShell = WScript.CreateObject(“WScript.Shell”)

WshShell.Run “%windir%\notepad.exe”
WshShell.AppActivate “Notepad”

WshShell.SendKeys “Hello World!”
WshShell.SendKeys “{ENTER}”
WshShell.SendKeys “abc”
WshShell.SendKeys “{CAPSLOCK}”
WshShell.SendKeys “def”

The SendKeys method is used to send keystrokes to the currently active window as if they where typed from the keyboard.

WshShell.SendKeys Keystrokes

Single alphanumeric keystrokes can simply be specified using a string representation of the character required. For example, to send the letter S the command would be object.SendKeys “S”.

To send multiple characters combine them into one string. For example, to send A, B and C the command would be object.SendKeys “ABC”.

The plus sign “+”, caret “^”, percent sign “%”, tilde “~”, and parentheses “()” all have special meanings and must be enclosed within braces “{}”. Square brackets “[]” must also be enclosed within braces although they have no special meaning. To specify brace characters themselves, use “{{}” and “{}}”.

Below is a table of characters that can not be directly represent by a keyboard character to use one of these, specify the appropriate Code.

Key Code

Key Code
Backspace {BACKSPACE}, {BKSP} or {BS}
Break {BREAK}
Caps Lock {CAPSLOCK}
Delete {DELETE} or {DEL}
Down Arrow {DOWN}
End {END}
Enter {ENTER} or ~
Escape {ESC}
Help {HELP}
Home {HOME}
Insert {INSERT} or {INS}
Left Arrow {LEFT}
Num Lock {NUMLOCK}
Page Down {PGDN}
Page Up {PGUP}
Print Screen {PRTSC}
Right Arrow {RIGHT}
Scroll Lock {SCROLLLOCK}
Tab {TAB}
Up Arrow {UP}
F1 {F1}
F2 {F2}
F3 {F3}
F4 {F4}
F5 {F5}
F6 {F6}
F7 {F7}
F8 {F8}
F9 {F9}
F10 {F10}
F11 {F11}
F12 {F12}
F13 {F13}
F14 {F14}
F15 {F15}
F16 {F16}


To specify characters combinations use the following codes:


Key Code
Alt %
Ctrl ^
Shift Lock +

For example to specify CTRL and C, the code would be object.SendKeys “^C” and for SHIFT F5 object.SendKeys “+{F5}”. To specify multiple combination sets such as ALT A Z, you use parentheses, for example, object.SendKeys “%(AZ)”.

Choosing Credit Cards overs Debit Cards

Credit cards have a few key advantages over debit cards and cash, they are far way more convenient. If you’d like to get more info about them then be sure to visit this website.

What Are The Lowest APR Credit Cards Available? | moneyfacts.co.uk

How card and debit cards work

When you make a purchase using your card, you make the amount of the purchase in small increments and add them to a prepaid card. This prepaid card is typically worth the exact amount you made, plus a small service charge to lock in the value of the charge, typically 1-2% per use.

Keep in mind that your card’s numbers are frequently derived from your Social Security number, and as such, your card’s security features are likely to be compromised. In addition to your own private information, card theft and fraud are just one threat that card issuers are especially responsible for to protect against.

Because card transactions usually are based on a person’s name and SSN, if those details are stolen, your bank’s point of sale system is automatically linked to the identity of the cardholder. Cardholders are then subjected to card-based fraud when they pay with cards or in person. The way card fraud is typically uncovered depends on how victims react to fraud alerts they receive and report the crime. Some card issuers may issue fraudulent chargebacks or take steps to detect fraud itself, while others may wait for further evidence before suspending a customer’s card.

Debit cards and credit cards

Credit cards and debit cards are not the same thing. At least, not all credit cards and debit cards work in the same way. Some debit cards work by having their own codes on the back of the card, while others use your credit card number to access them. You can use your debit card in place of your credit card, as well as use the debit card to make online purchases. In the case of online purchases, the online payments network also provides the authorization code for the credit card payments.

Unlike debit cards, there are generally no fees associated with either type of credit card. But beware that the payee, for example, is sometimes paid by credit card or debit card to which the payee has restricted access. Additionally, some banks and credit card issuers may charge additional fees to use multiple debit cards.

SharePoint 2010 Retrieve All User Group Memberships

To view a list of all groups and user memberships for a certain SharePoint 2010 site collection try this PowerShell script. Be sure to change the name of the SharePoint site in the script under the $site variable.

$site = New-Object Microsoft.SharePoint.SPSite("http://server/sites/sitecollectionname")
$groups = $site.RootWeb.sitegroups
foreach ($mygroup in $groups)
"Group: " + $mygroup.name;
foreach ($user in $mygroup.users)
" User: " + $user.name

Loving Firefox 14 Install

I just updated to firefox 14 and it’s working very well.  It has SSL connections when you do a search which is a very good feature.  It has cross platform plugins disabled so you don’t get browser plugin malware.  I was using chrome for a while but have gone back to my roots.  I really like the firefox sync so all my bookmarks on the browsers on multiple computers are all auto synced.  And firefox does not consume a ton of memory to run.  It also fills out my forms better than the other browsers.

July 9, 2012 Malware Detection and Removal

Thousands of people may loose their internet service on Monday, July 9, 2012 because of Malware that has been infecting computers from the internet and email.  The FBI helped setup a site to test your computer and show you how to fix it.

Step one.  Go to http://www.dcwg.org/detect/ and click on the circled link shown below.

You should see the below page:


If you don’t, go here: http://www.dcwg.org/fix/ and follow the instructions.

Get size of a SharePoint 2010 Database with the SQL Command sp_spaceused

Get the size of a SharePoint 2010 database with the SQL command sp_spaceused:


Enabling Remote WMI and DCOM by Command Line on Remote Computer

Enabling Remote WMI and DCOM for PowerShell Use
Many cmdlets have a built-in -ComputerName parameter that will allow for remote access without using the new PowerShell remoting. For this to work, your firewall will need to be adjusted on the target machine:
netsh firewall set service type = remoteadmin mode = enable
In addition, some cmdlets (like Get-Service) will need the Remote Registry service to be running on the target side:
Start-Service RemoteRegistry
Set-Service RemoteRegistry -StartupType Automatic

SharePoint 2010 PowerShell – List all timer job history a certain time range to CSV file

Since we wrote this script it has helped us get info about specific jobs really quickly. You can download this script here: SharePoint 2010 – Get Job History or copy it here:

$test = Get-SPWebApplication "http://intranet/"
$myStartTime = "9/29/2011 12:30:00 AM"
$myStopTime = "9/29/2011 3:30:00 AM"

Write-Host "Fetching all jobs to JobHistoryOutput.csv for $myStartTime - $myStopTime..." -ForeGroundColor Red
$test.JobHistoryEntries | Where-Object {($_.StartTime -gt $myStartTime) -and ($_.StartTime -lt $myStopTime)} | Export-Csv JobHistoryOutput.csv –NoType
Write-Host "Done! Check JobHistoryOutput.csv for info." -ForeGroundColor Green

Write-Host "Fetching all errors to JobHistoryOutputErrors.csv for $myStartTime - $myStopTime..." -ForeGroundColor Red
$test.JobHistoryEntries | Where-Object {($_.StartTime -gt $myStartTime) -and ($_.StartTime -lt $myStopTime) -and ($_.Status -ne 'Succeeded')} | Export-Csv JobHistoryOutputErrors.csv –NoType
Write-Host "Done! Check JobHistoryOutputErrors.csv for info." -ForeGroundColor Green

Retreiving SharePoint 2010 Jobs Details by Date and Time
1. Log onto your SharePoint 2010 application server with farm admin rights.
2. Run SharePoint Admin Shell.
3. Change the SharePoint application in the script on line 2 (mine was http://intranet). Change the dates and times in the scriptlines 3 and 4.
4. Run the script as shown below:

5. View output from the script:

6. You’ll get two files. C:\JobHistoryOutput.csv is all jobs. C:\JobHistoryOutputErrors.csv is jobs that didn’t get a “Succeeded” status. Sort and filter in excel for the results you want: JobDefinitionId, JobDefinitionTitle, WebApplicationId, WebApplicationName, ServiceId, ServerId, ServerName, Status, StartTime, EndTime, DatabaseName, ErrorMessage

Powershell to Get the count of user objects in Active Directory using LDAP Query

$Domain = ‘LDAP://DC=yourdomain;DC=com’
$Root = New-Object DirectoryServices.DirectoryEntry $Domain
$select = New-Object DirectoryServices.DirectorySearcher
$select.SearchRoot = $root
$adobj= $select.findall() |? {$_.properties.objectcategory -match “CN=Person”}

For the $Domain variable change the “yourdomain” string to the name of your domain.