Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Creating a country based shortcut on desktop with Powershell gives the same result every time

$
0
0

I've created the following script that's supposed to create a different shortcut on the desktop based on the value of the "iCountry" key in the registry. The problem is that it always creates the same shortcut (if loop nr 2).

What am I doing wrong?


$lang = 'HKCU:\Control Panel\International'
(Get-ItemProperty -Path $lang -Name iCountry).iCountry

if ($lang -eq 358) 

{
$WshShell1 = New-Object -comObject WScript.Shell
$Shortcut1 = $WshShell1.CreateShortcut("$Home\Desktop\Gigantti Remote Fix.lnk")
$Shortcut1.TargetPath = "http://www.123rescue.com"
$Shortcut1.IconLocation = "Shell32.dll, 135"
$Shortcut1.Save()
}

if ($lang -eq 46 -or 45)

{
$WshShell2 = New-Object -comObject WScript.Shell
$Shortcut2 = $WshShell2.CreateShortcut("$Home\Desktop\Elgiganten Remote Fix.lnk")
$Shortcut2.TargetPath = "http://www.123rescue.com"
$Shortcut2.IconLocation = "Shell32.dll, 135"
$Shortcut2.Save()
}


if ($lang -eq 47)

{
$WshShell3 = New-Object -comObject WScript.Shell
$Shortcut3 = $WshShell3.CreateShortcut("$Home\Desktop\Fjernhjelp.lnk")
$Shortcut3.TargetPath = "http://www.123rescue.com"
$Shortcut3.IconLocation = "Shell32.dll, 135"
$Shortcut3.Save()
}


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>