Posts

Using PowerShell to prevent desktop lockouts... Hola Everyone, Today i wont talk too much because I am kinda loaded, As you see from the heading I wrote these two scratches which will prevent's your desktop from getting lockout. Normally a PC in a domain will be forced to obey some rules, the rules that comes from group policy. One of these famous rules are the lock out time of desktops when the desktop is idle and not used. This can be a problem sometimes specially if the PC is running some process which will be affected some how in case the PC got locked. As rory gallagher used to say on some of his gig's, LETS GET TO WORK!!! : This code Send keys(TAB key) to make the system feel that it's not idle : # Code start here while ($true){ # wait for 40 seconds every time before it hit the key Start-Sleep -seconds 40 [System.Windows.Forms.SendKeys]::SendWait("{%}") | out-null }  # Code end here And this one w...
Using  Selenium WebDriver with PowerShell Hola todos... que pasa? This time I am going to show an example on how to use Selenium WebDriver with PowerShell to open the browser and do stuff like checking a checkbox or maybe writing some text in a text box. This one took me sometime to deal with it, it was not a straightforward thing, I spent so much time in front of my laptop, I lost the feeling on my ass for some time after finishing the code, anyway, To find more information about Selenium and how it works, you can dig this link :   http://www.seleniumhq.org/ this WebDriver was built for C#, and of course it can be used and called withing PowerShell or Vb.net easily... Anyway, let’s talk about the code : #Code Start Here : # moving to the folder where Selenium DLL files are… # You can also use Add-Type Cmdlet with -path option, it will do the same. cd "d:\NonOfficialPSModules\selenium-dotnet-2.46.0\net40" [System.Reflecti...

IP Calculator in PowerShell...with IP exclusion

Hola todos... que pasa? It has been a while since i post i was really busy with so many stuff, bottom line, i had this strange requirement at work where i had to create a script to calculate the IP address from a subnet, now normally this means we have to create a bunch of scopes or subnets in the DHCP server, which was my case, i had to create more than 4 thousand scopes on Linux DHCP server. now I was thinking how in the hell I am going to insert all these scopes in the configuration file, of course the first things I came up with was to provide the mandatory information (First IP, last IP, broadcast IP and number of hosts) which was not a big problem, I found this link : https://gallery.technet.microsoft.com/scriptcenter/ipcalc-PowerShell-Script-01b7bd23 This guy did a very good job and save my ass, but this was not the issue, in my situation, I had to exclude the first 48 IP addresses from each scope. Now in Linux DHCP configuration file, each scope was represent...