My little contribution to this amazing comunity

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

Viewing 2 reply threads
  • Author
    Posts
    • #77815
      Participant
      Topics: 2
      Replies: 2
      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
      Topics: 25
      Replies: 700
      Points: 1,777
      Helping Hand
      Rank: Community Hero

      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
      Topics: 2
      Replies: 2
      Points: 0
      Rank: Member

      Noooice!

Viewing 2 reply threads
  • The topic ‘My little contribution to this amazing comunity’ is closed to new replies.