Skip to main content

Posts

Showing posts from January, 2016

Able to ping but cannot browse in Windows

If the PC, Laptop or Server has ever worked before then it will be easier to troubleshoot. Since it has worked before, what are the changes done to the machine? If there are quite a few changes done to the machine, undo or remove all the changes done. After removing or undoing all the changes, check whether web page will load or not. If still not working, try "resetting" the browser settings. For IE or Internet Explorer, go to "Tools", click "Internet options", click "Advanced" tab and click on "Reset" button. Close the browser and open again, check whether the page will load or not. If still not loading, open an elevated command prompt and do the following one by one: To open an elevated command prompt you need administrator credentials, check out the link below on how to open an elevated command prompt. http://quickbytesstuff.blogspot.sg/2014/10/open-elevated-command-prompt.html    ipconfig /flus

PowerShell Get Registry Values or Entries

Navigating the registry is sometimes annoying you need to click here and there. With the use of PowerShell life can be easier, provided you know exactly the complete registry path. Below is a PowerShell cmdlet that will list all the software that will run automatically on the computer for all users. Get-ItemProperty -Path Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run The PowerShell cmdlet below will list the software that will run automatically for the currently logged on user in which the command is executed. Get-ItemProperty -Path Registry::HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run Sample Output: Akamai NetSession Interface : "C:\Users\User_007_JB\AppData\Local\Akamai\netsession_win.exe" ISUSPM                       : "C:\ProgramData\FLEXnet\Connect\11\ISUSPM.exe" -scheduler                                                                                                              

Download Windows 10 ISO

Ever want to download the ISO file for Windows 10 but keeps getting an error. To download Windows 10, click on the link below and on Microsoft Webpage scroll down and click on "Download tool now". Click "Using the media creation tool" on how to use this tool. Link to download Media creation tool: https://www.microsoft.com/en-gb/software-download/windows10 Download the tool; once its downloaded the file name should be "Media Creation Tool". ISO file is around 3GB so depending on your bandwidth it make take some time. If your bandwidth is not reliable use a browser that continue or resume the download, even though the connection was disconnected. Firefox supports this feature. If the tool is executed at an elevated mode, you will receive an error like: There was a problem running this tool We're not sure what happened, but we're unable to run this tool on your PC. If you continue experiencing problems, reference the err

List all files with a particular extension using PowerShell

One liner command to list files with a specific extension in a given path. Command below will list all the file that will match and display it's file name, file size and the directory where the file is located or found. The output of PowerShell is redirected to a text file. $FileExtension=".key" $FilesDir = get-childitem "d:\CertKeys" -recurse | where {$_.extension -eq $FileExtension } | format-table name,length,Directory -AutoSize $FilesDir | out-file "d:\certkey.txt" Or save some few bytes by using the shorter form of the cmdlets. $FileExtension=".key" $FilesDir = gci "d:\CertKeys" -recurse | ? {$_.extension -eq $FileExtension } | ft name,length,Directory -AutoSize $FilesDir | out-file "d:\certkey.txt" Sample Output: Name                          length         Directory  ----                              ------          ---------  ssl.key ca.key                        963    D:\CertKeys\apa

List online computers in an OU via PowerShell

Using Get-ADComputer cmdlet and some filtering options, getting the list of online computers is quite straight forward using the one liner command below. Code below will get all online computers with "MKT" on their computer name, computers that are enabled in Active Directory and using an XP operating system. Once a match is found PowerShell will send a ping and if the connection is successful, the computer name will be displayed as the output of the script. Get-ADComputer -Filter {(Name -like "*MKT*") -and   (OperatingSystem -like "*XP*") -and (Enabled -eq $True)} -Properties * -SearchBase "CN=Computers,DC=GOLDEN_DOMAIN,DC=local" | Where-Object { Test-Connection $_.Name -Count 1 -Quiet } | Select -ExpandProperty Name The -SearchBase option provides the parameter to search for the computers. Change this option as necessary. To get all the properties of an specific AD computer use the code below: Get-ADComputer -

Windows get running processes

Display via command line all running processes in Windows. Tasklist is a command line to list currently running proccesses either on a local or a remote computer. Tasklist also provides filters to display status of programs either not responding or running. Command line below shows all processes that are "Running":        tasklist /fi "status eq Running" To display process that are not responding simply change the filter value to:        tasklist /fi "status eq Not Responding" Since Tasklist provides the option to list running and not responding processess. Taskkill is a command line to stop, close or kill processes. Command below will kill or close any open instances of Excel.         taskkill /im "excel.exe" /f To close any unresponsive processes use the command below:         taskkill /f /fi "status eq not responding" To have fun with Windows try command below:          

Search filenames with pattern using PowerShell

How to find files in directories with PowerShell? Using PowerShell get-childitem or gci for short searching for filename with specific pattern is quite an easy task.   In combination with regex search can be accurate or complex. PowerShell code below will search recursively on the path specified and will return the file name that matches the pattern. If the path has multiple subfolders, the subfolder along with the filename will be shown if it matches the pattern. Get-ChildItem –Path "C:\Users\" -name -Recurse | Select-String -Pattern "7" or gci -path "C:\Users\" -name -recurse | Select-String -Pattern "7" -pattern can be replaced with regex pattern Sample output: Win 7 VM.xlsm   New folder\win 7.txt Win 7 VM.xlsm -no folder on the path which means file is located under c:\Users\ New folder\win 7.txt - located on a subfolder complete path is c:\Users\New folder\ Here's another exam