There is always another way!

26 47
Avatar for Khing14
3 years ago
Date: October 26, 2010

Note: You might find the first part of this article too technical and most of the terminologies are from IT perspective. If you're a non-IT, you may focus on the second part of this article which contains the actual message that I wanted to convey with you. These are the lessons that I've learned based on what I've experienced the past few days in my work.

Last week, I have written an article about my latest automation in my current job. It was entitled Powershell : My new language.

For those who are not able to read the aforementioned article, basically, I have created a script that will check if all users who have access to our supported applications still exist in Active Directory or in other words if they are still part of the firm. I named my script as Leavers Checker. It is written in PowerShell programming language which is new to me because I don't really have previous exposure on writing a PowerShell script. I am more exposed in Unix scripting.

Everything is already working. The script is running fine from my local machine. Basically, the script that I have created will save us a lot of time and effort.

The problem started when I decided to deploy it in one of our production server. It was not able to execute the script because of missing module (SQLPS) in our production servers which is needed to be able to access our production database remotely.

I then seek some help from our infrastructure team to install the necessary program/s or PowerShell module to make my script work.

But then looks like my request is also new to our Windows support team.

They tried to install few programs already but unfortunately, I am still getting the same error. The system is still not able to recognize the command that I am using to extract the list of users from our database remotely. I felt hopeless already because even the Windows expert couldn't resolve my issue and couldn't make my script run.

But then I did not loose hope. I really wanted to make my script work because it will be very beneficial for the team in the long run.

Yesterday, I tried to google the alternative command I can use which will not require additional program to be installed into a server. And luckily, I bumped into a blog that has very the same issue as mine and when I scrolled down further, I found the answer!.

Initially, I've been using invoke-sqlcmd to access our database remotely and get the list of users directly from the DB. I found the useful post that has all the details in it.

Below is the portion from the post which I found to be very useful.

function SqlQuery($server, $database, $query)
{
 $connection = New-Object System.Data.SqlClient.SqlConnection
 $connection.ConnectionString = "Server=$server;Database=$database;Integrated Security=True;"
 $connection.Open()
 $command = $connection.CreateCommand()
 $command.CommandText = $query
 $result = $command.ExecuteReader()
 $table = new-object “System.Data.DataTable”
 $table.Load($result)
 $connection.Close()
 return $table
}

SqlQuery $Server $Database "SELECT * FROM Staff"

This line actually caught my attention:

And since I know that our production server has .NET installed, I know that this solution might work. But then again, there's also possibility that it won't work.

So I modified my code and use the aforementioned script to extract user details from our database and run it to my local machine first. It works!.

And here is the thrilling part again. I deployed my script to one of our production servers and I almost jump with joy when finally, it works!. My script is working perfectly!.

And this is one goal down for this fiscal year!.

What I am trying to say is, there seems to be a situation where you already felt hopeless. That despite your multiple attempts to solve a problem, you just keep on failing. Despite on how many times you stand up and try, you keep on falling.

That whenever you tried to apply the available solutions, it's not working at all. You've already seek other's help but it seems that the situation is not going along with you but it is always against you.

Instead of pushing through with your current strategy, where despite of your multiple attempts, none of them actually worked, why not try a different way? Try another path! Turn right or left and check if that path will lead you to your goal.

Image source

Just like in mathematics right? There are multiple ways we can solve a specific problem but what matters most is we have arrived to the correct answer. Regardless of the formula that we used or applied, as long as we have achieved the expected output, then we should be good!.

THERE is NO HARM in TRYING!

Try to step outside of the box for you to see the other solutions available out there!. There is always another way for you to reach and achieve your goals. Don't be confined or stuck in a single path. You should try and turn to different path if you see no progress at all with the current path that you are taking.

Sponsors of Khing14
empty
empty
empty

14
$ 8.25
$ 7.99 from @TheRandomRewarder
$ 0.05 from @Jane
$ 0.05 from @Ruffa
+ 6
Sponsors of Khing14
empty
empty
empty
Avatar for Khing14
3 years ago

Comments

When there's a will, there's a way. Charaught. Pero totoo sis, we just need to explore and find new ways to solve the problems. I know that every problems has a solution anyways.

$ 0.01
3 years ago

yes sis. For sure may solusyon ang mga problema.

$ 0.00
3 years ago

Maybe we can't find the right solutions in our Problems, Always keep finding ways to solve make it to the right path.

$ 0.01
3 years ago

agreed...we must not afraid to take different path

$ 0.00
3 years ago

I have come to realize that the hardest part of programming isn't writing the codes, but it's debugging. You will spend ours looking for what went wrong with your code but at the end you will realize that it's just a missing curly bracket 😆 Ma'am, are you a backend engineer?

$ 0.01
3 years ago

I am level 2 support actually. It's just my initiative to look for automation opportunity and this is one!.

$ 0.00
3 years ago

Try lang ng try. Debug lang ng debug 🤣

$ 0.01
User's avatar Yen
3 years ago

truth..run lang ng run..aghahahaha

$ 0.00
3 years ago

programmer ka pala ate, same din pala kayo ng kuya at ate ko more on computer thingy din kasi sila

$ 0.01
3 years ago

yes sis :)..sa IT ako ..hehe

$ 0.00
3 years ago

Ako na IT graduates pero dahil sa tagal ng di nakakahawak ng laptop ayon, nganga wala ng alam huehue. Ang hirap ng walang lappy di ako maka explore 😩. But anyways, lahat ng problems may solusyon, you just have to look for another way.

$ 0.01
3 years ago

Totoo sis.. Naresolve ko probs ko by looking at possiblr alternatives..

$ 0.00
3 years ago

huhu. nosebleed ako nito sis. Nag IT pa ako pero walang alam sa codes haha

$ 0.01
3 years ago

Hehe. Kaya nga may naka note na ako sa unahan sis..

$ 0.00
3 years ago

Is it PHP sis? hihihi Di kasi ako marunong sa mga codes-codes na yan.

Anyways, as they say, in every problem, there's a hundred of solutions for that. So kung hindi mo nasosolve ang isang problema, hanap ka ulit ng ibang solution.

$ 0.01
3 years ago

Ayun tumpak sis.. Yun ang mismong gusto kong ishare.. Huwag mong ipilit yung isang way kung ayaw.. Hanap ng iba diba?

$ 0.00
3 years ago

Parang science din xia sis, experiments can create new knowledge ..

$ 0.01
3 years ago

Ayun tumpak ka sis.. Kailangan natin mag experiment para malaman kung alin ang magwowork

$ 0.00
3 years ago

Programmer k pla?

$ 0.01
3 years ago

Yes po..hehe

$ 0.00
3 years ago

There is nothing to lose when trying. When you did not try, you will never know of you made it or not. Don't give up. 😊

$ 0.01
3 years ago

definitely!...you will never know that it's possible until you made it done!.

$ 0.00
3 years ago

Try and try and don't give up, and don't be afraid of failure because it's a part of success.

$ 0.01
3 years ago

you are definitely right!. Failure is part of our success!

$ 0.00
3 years ago

Keep trying until you get it. If you don't get it. Then it isn't the end. With each failure you grow stronger and get more armed with your tools for success.

$ 0.01
3 years ago

Very well said.. You've articulated well what i am trying to convey

$ 0.00
3 years ago