Get Live Currency Rate From Yahoo Finance API

Here is a simple PHP Function to get live currency conversion from Yahoo Finance API

In my example i am gettting the value of 100 Dansih Krone in US Dollar

<?php
function yahoofinance_convert($from, $to) {
$url = 'http://finance.yahoo.com/d/quotes.csv?e=.csv&f=sl1d1t1&s='. $from . $to .'=X';
$handle = @fopen($url, 'r');

if ($handle) {
$result = fgets($handle, 4096);
fclose($handle);
}
$return = explode(',',$result);
$to_value = $return[1] * 100;

return $to_value;
}

echo "Value of 100 DKK is " . yahoofinance_convert("DKK", "USD") . "$";

?>
No tips yet.
Be the first to tip!

Like this post? Tip me with bitcoin!

12NPGXbHbfoRi689VRG88CF6XaHUM6oj8p

If you enjoyed reading this post, please consider tipping me using Bitcoin. Each post gets its own unique Bitcoin address so by tipping you're not only making my continued efforts possible but telling me what you liked.

VN:F [1.9.22_1171]
Rating: 5.5/6 (4 votes cast)

Enable all users in an OU for Lync 2010 with Powershell

If you want to enable all users in a OU for lync use this powershell command:

get-csADuser -OU "OU=Office,OU=Head,dc=dcserver,dc=local" | Enable-CsUser -RegistrarPool YOUR-LYNC-POOLSERVER -SipAddressType emailaddress
No tips yet.
Be the first to tip!

Like this post? Tip me with bitcoin!

1AGqb41eXdrN6ve1dfA9u2yKDoVsZxa8Hu

If you enjoyed reading this post, please consider tipping me using Bitcoin. Each post gets its own unique Bitcoin address so by tipping you're not only making my continued efforts possible but telling me what you liked.

VN:F [1.9.22_1171]
Rating: 0.0/6 (0 votes cast)

Set calendar-permissions for mailboxes in Exchange Server 2010

I was looking for at way to set default calendar-permissions in exchange 2010, and found out that the only way to do this, is the scripting way.

So i found a script and modified it ( ALOT ) to fit my need


#Load Exchange Server 2010 Management Shell if not loaded.

if (-not (Get-PSSnapin | Where-Object {$_.Name -like "Microsoft.Exchange.Management.PowerShell.E2010"})){
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010
}

#Custom variables
$mailboxes = Get-Mailbox
$AccessRights = "Reviewer"

#Loop through all mailboxes
foreach ($mailbox in $mailboxes) {

#Retrieve name of the user`s calendar
$calendar = (($mailbox.SamAccountName)+ ":\" + (Get-MailboxFolderStatistics -Identity $mailbox.SamAccountName -FolderScope Calendar | Select-Object -First 1).Name)

#Check if calendar-permission for user "Default" is set to the default permission of "AvailabilityOnly"
if (((Get-MailboxFolderPermission $calendar  | Where-Object {$_.User -like "Default"}).AccessRights) -like "AvailabilityOnly" ) {

Write-Host "Updating calendar permission for $mailbox..." -ForegroundColor Yellow

#Set calendar-permission for user "Default" to value defined in variable $AccessRights
Set-MailboxFolderPermission -User "Default" -AccessRights $AccessRights -Identity $calendar
}
}

And then a bat file to execute it from “scheduled task”


powershell -command "&amp; 'C:\PATH-TO-FILE\Set-CalendarPermissions.ps1' "

No tips yet.
Be the first to tip!

Like this post? Tip me with bitcoin!

13FFT2E9nXwhf2VjsKaLcmQM3TRWPY7ip4

If you enjoyed reading this post, please consider tipping me using Bitcoin. Each post gets its own unique Bitcoin address so by tipping you're not only making my continued efforts possible but telling me what you liked.

VN:F [1.9.22_1171]
Rating: 5.3/6 (3 votes cast)

Lync 2010 Assign Client Policies By Active Directory Groups

After we got our new Lync 2010 setup done, we was missing one key feature.
We want to assign Client policies by Active Directory groups instead of the need to login to Lync admin and change it.

So we made a simple powershell script to do the work for us

save it as Lync-SetClientPolicy.ps1

Import-Module "C:\Program Files\Common Files\Microsoft Lync Server 2010\Modules\Lync\Lync.psd1"
$ADGroupName = $args[0]
$ClientPolicy = $args[1]

$strFilter = "(&amp;(objectCategory=Group)(SamAccountName=" + $ADGroupName +"))"
$objDomain = New-Object System.DirectoryServices.DirectoryEntry

$objSearcher = New-Object System.DirectoryServices.DirectorySearcher

$objSearcher.SearchRoot = $objDomain

$objSearcher.Filter = $strFilter

$objSearcher.SearchScope = "Subtree"

$colProplist = "member"

foreach ($i in $colPropList)

{[void] $objSearcher.PropertiesToLoad.Add($i)}

$colResults = $objSearcher.FindAll()

foreach ($objResult in $colResults)
{
$objItem = $objResult.Properties;
$group = $objItem.member
}

foreach ($user in $group)

{
$userlync= Get-CsUser -Identity $user
if ($userlync.ClientPolicy -like $ClientPolicy)
{

}
else
{
Grant-CsClientPolicy $user -PolicyName $ClientPolicy
}

}

And then a bat file to execute it from “scheduled task”

powershell -command "&amp; 'C:\script\Lync-SetClientPolicy.ps1' "Lync-ClientPolicy-Sales" "Sales" "
powershell -command "&amp; 'C:\script\Lync-SetClientPolicy.ps1' "Lync-ClientPolicy-Default" "Default" "
No tips yet.
Be the first to tip!

Like this post? Tip me with bitcoin!

18EGKwadgG17mPretfTmpsMrNWMtcAJKSF

If you enjoyed reading this post, please consider tipping me using Bitcoin. Each post gets its own unique Bitcoin address so by tipping you're not only making my continued efforts possible but telling me what you liked.

VN:F [1.9.22_1171]
Rating: 0.0/6 (0 votes cast)