My little contribution to this amazing comunity

Tagged: 

This topic contains 2 replies, has 2 voices, and was last updated by  Goran Ipac 1 month ago.

  • Author
    Posts
  • #77815

    Goran Ipac
    Participant

    Hello all, i'm on this forum for a while and i find it amazing resource pool for almost anything i can image for creating useful tools and scripts.
    To cut the story short, i decided to share my humble script if anybody finds it helpful. I know i did...:)
    Script is simple, it gets date and creates folder for that date and then copies from source to destination.
    It gets list of computers from text file, then proceeds to list all filtered content(in this case, i needed folders with exact part of the name)
    As i said, simple but thats what PS is all about, right? Make it simple, guys! Cheers

    $today = Get-Date -Format "dd-MM-yyyy"
    $computers = Get-Content "C:\computers.txt"
    $folders = gci "\\$computers\D\*" -Directory -Filter *filter names of folders* 
    
    
    
    Foreach ($computer in $computers){
    
    
            if(!(Test-Path -path "c:\test\$computer"))
            {
                New-Item -ItemType directory -path "c:\test\$today\$computer" 
                
            }
    
         
        
            Copy-Item $folders -Destination "c:\test\$today\$computer" -Recurse
            }
    
  • #78019

    js
    Participant

    How you like this one?

    Function Get-Arp
    {
        arp -a | select -skip 3 | foreach {
            $ip,$mac,$type = -split $_
            New-Object -Type PSObject -Property @{
                InternetAddress = $ip
                PhysicalAddress = $mac
                Type = $type
                HostName = (resolve-dnsname -DnsOnly -ErrorAction SilentlyContinue $ip).NameHost
            }
        }
    }
    
  • #78100

    Goran Ipac
    Participant

    Noooice!

You must be logged in to reply to this topic.