• /r/powershell
  • Help with powershell command

    I trying to create a script that will run weekly to move an .mkv file that was created in the last 24 hours to another folder. The current script below will move a .txt file with out issue but not the .mkv file. Set-Location P: Get-ChildItem “P:TV ShowsPower” | Where-Object {$_.LastWriteTime -gt (get-date).AddHours(-24)} | Copy-Item […]

  • /r/powershell
  • Get-ADComputer results are wrong

    I have what should be a fairly simple script where it spits out computers that don’t have a “ManagedBy” user listed. The code is pretty straight forward Get-ADComputer -Filter * | where ManagedBy -eq $Null > C:ScriptsManagedBy.txt The Results look like I’d expect them to DistinguishedName : CN=Computer1234,OU=Desktop,OU=Win7,OU=Workstations,OU=Computers,OU=cool,DC=mydomain,DC=com DNSHostName : Computer1234.mydomain.com Enabled : True ManagedBy […]

  • /r/powershell
  • Read-Host collecting multiple values

    Hi guys, adding a further function to my ever growing script – this for adding members to a distribution group. The standard format would be something like this if I were to use the built in cmdlets Add-DistributionGroupMember -Identity “Groupnamehere” -Members “User1@company.com, user2@company.com, user3@company.com” However I’m trying to use read host so the script can […]