My little contribution to this amazing comunity

Welcome Forums General PowerShell Q&A My little contribution to this amazing comunity

This topic contains 2 replies, has 2 voices, and was last updated by

 
Participant
1 year, 3 months ago.

  • Author
    Posts
  • #77815

    Participant
    Points: 0
    Rank: Member

    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
    Points: 315
    Helping Hand
    Rank: Contributor

    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

    Participant
    Points: 0
    Rank: Member

    Noooice!

The topic ‘My little contribution to this amazing comunity’ is closed to new replies.