FIX: PowerShell V1.0 : Unrecognized token in source text.

When you try to print or access the Hashes in PowerShell v1.0 using @ operator, you’ll receive the error message detailed in this article below.  In PowerShell v1.0, you instead need to use $ operator to refer to an hash variable. Code: $email = @{} $email.Add("From", "TestSender") $email.Add("To", "Webmaster@example.com") $email.Add("Subject", "Test mail from PowerShell 1.0") $email.Add("Body", “Hi There, Reply me back”) @email   Error: PS C:Test> powershell C:Testtest-hases.ps1 Unrecognized token in source text. At C:packagingtest-hases.ps1:9 char:13 +     write-host @ <<<< email PS C:Test>   Fix: In PowerShell v1.0, a hash cannot be print using the @<hashname> operator. Instead, you can […]

Read more

FIX: Attempt to load Oracle client libraries threw BadImageFormatException. This problem will occur when running in 64 bit mode with the 32 bit Oracle client components installed

Environment: You are on a Windows 7 x64 bit System Using PowerShell x64 bit Authoring a script that connects to Oracle Database via "System.Data.OracleClient" Sample Script: $connectionString = "Data Source=ORADB01.TESTLAB.LAN;User Id=root;Password=R00tUs3r;Integrated Security=no" $queryString = "select * from users where username like ‘%govardhan%’" [System.Reflection.Assembly]::LoadWithPartialName("System.Data.OracleClient") | Out-Null $connection = New-Object System.Data.OracleClient.OracleConnection($connectionString) $command = new-Object System.Data.OracleClient.OracleCommand($queryString, $connection) $connection.Open() $resources = $command.ExecuteReader() # Write out the results while ($resources.read()) {     $Process=$resources.GetDecimal(0)     $Status=$resources.GetString(1)     Write-Host $Process $Status     } $connection.Close()   Output:   PS C:>Powershell C:tempSend-Activation-Emails.ps1 Exception calling "Open" with "0" argument(s): "Attempt to load Oracle client libraries threw BadImageFormatException.  This problem will […]

Read more

Understanding how user usernames and passwords are saved, retrieved and verified on websites

Environment: Lets consider you have a web site that is developed in PHP with MySQL DB in the backend and pages being served via the Apache Web Server.  All are freeware technologies with appropriate licensing terms.   End User input to Webpage and Webpage to Php script: A user login and/or registration page will prompt user for providing the username and password to access the site content.  The Login page form, will pass the user provided username and password to the appropriate php script.   Php Script to/from DB and back to Web page form: The php script will make […]

Read more