Category Archives: Powershell

How to Ping a List of Computers

Many times It happens that we need to check if a list of computers is active, so how do you ping multiple computers at once?

Use this Powershell script to test connectivity to your list of computers. it will produce two lists of Bad (unresponsive) and Good(Responsive) computers.

You need to change “D:\scripts\list.txt” to the path where your saved your computers list.

Also, you can un-comment  #Write-Host $name… to view the list if computers with different colors

$Mylist = Get-Content D:\scripts\list.txt
Clear-Host
[System.Collections.ArrayList]$GoodArrayList = @()
[System.Collections.ArrayList]$BadArrayList = @()
 

foreach ($name in $Mylist){
  if (Test-Connection -ComputerName $name -Count 1 -ErrorAction SilentlyContinue){
    #Write-Host $name -ForegroundColor Cyan
    $GoodArrayList.Add($name)
  }
 
else{
    #Write-Host $name "down" -ForegroundColor Red
    $BAdArrayList.Add($name)
  }
}
Write-Host -ForegroundColor Cyan "Good"
$GoodArrayList
Write-Host -ForegroundColor Red "BAd"
$BadArrayList

Create SCCM Distribution Point with Powershell

Hi Sysadmins

You need to create multiple SCCM 2012 Distribution points fast and accurate!

Maybe you decided on upgrading your  environment to SCCM 2012 or your company purchased another organisation. In any case,

The reasonable way will be to use a script, and not use the GUI to do the task over and over.

The preferred scripting environment is Powershell, since it already has many Configuration Manager commandlets that can be helpful.

You do have to work with at least SCCM 2012 sp1 version for the following script to work.

The below Powershell script will read the names of the Distribution points servers from a file. See example for the file Here 

Continue reading Create SCCM Distribution Point with Powershell

How to install IIS features on SCCM 2012 Distribution Point with command line

Hi SysAdmins

Did you ever wonder how SCCM 2012 install a DP remotely from the CM console?

DISM.exe (Deployment Image Servicing and Management tool) is a command line tool that you can use to enable or disable Windows features.

In this case we use it to install all the necessary IIS features for a SCCM 2012 DP.

Command line to install IIS on DPs:

Continue reading How to install IIS features on SCCM 2012 Distribution Point with command line

Copy files to Remote computers using powershell

Hi SysAdmins

In an earlier post I described – How to copy files to domain member computers or servers using Group Policy Object (GPO).

In this post I will show how to copy files to remote computers or servers using a simple Powershell script and .txt file.

728x90_never-forget-password

All you need is:

A txt file that looks like this:

Server1.yourdomain.com
Server2.yourdomain.com
Server3.yourdomain.com
and so on…

You can use IP addresses as well.

And this piece of Powershell code:


$ServerList = Get-Content "C:\ServersList.txt" #Change this to location of servers list
$SourceFileLocation =  #For example: D:\FoldertoCopy\ or D:\file.txt
$Destination =  #Example: C$\temp

foreach ($_ in $ServerList)
 {Copy-Item $SourceFileLocation -Destination \\$_\$Destination -Recurse -PassThru}

Save the above code as CopyFilestoservers.ps1, and your servers list as ServersList.txt

You will need Write permissions on the remote machines to run the script successfully.

How to Add Hebrew to Powershell or Command (CMD) Console

Hi SysAdmins

Did you ever ran into a situation where you need to add a foreign language to the powershell or Command console? let’s say for script output purpose.

It seems that the process of adding Non-Latin characters is not widely documented.

In this example I will demonstrate how to add Hebrew writing to Powershell. This will also affect the Command (CMD) console.

Continue reading How to Add Hebrew to Powershell or Command (CMD) Console

How to get a remote servers’ TCP/IP configuration: IP, DNS, GW via PowerShell

Hi

When you need to know the DNS configurations of a remote machine without logging in to that machine.  Using a script that can do the job on remote computers is the answer.

There are some very good Ebooks online that can teach you how to do this.

This nice Powershell script will do the work. The source I found on this web site and changed it for my needs.

Continue reading How to get a remote servers’ TCP/IP configuration: IP, DNS, GW via PowerShell