Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista - Searching and removing files from an OU.

Reply
 
Old 11-29-2007   #1 (permalink)
techjohnny


 
 

Searching and removing files from an OU.

I'm running Windows Powershell 1.0 and would like to know of a way to
scan our network of 50+ computers in an ADSI OU to remove certain
files from their desktop?

I'm trying to remove all shortcuts to a program that no longer exist,
and it begins with the characters Vista 8.03.

Any help would be great.

Thanks,

--TJ

My System SpecsSystem Spec
Old 11-29-2007   #2 (permalink)
Kirk Munro


 
 

Re: Searching and removing files from an OU.

Hi TJ,

That's a great request, and PowerShell definitely is the right tool for the
job.

Assuming that you're running in the context of an administrator of these 50+
computers, you could do this:

Get-QADComputer -SearchRoot 'company.com/ComputersOU' | ForEach-Object {
Remove-Item -Path "\\$($_.Name)\c$\Documents and
Settings\*\Desktop\Vista 8.03*" -WhatIf

}

Note that I added -WhatIf to show you what the script will do before you
actually run it. This supports multiple profiles on each computer, and
assumes that the profiles are all stored on the C drive and that you have an
administrative share on that drive.

Also note that this uses Quest's AD cmdlets. These cmdlets are free and
simplify working with AD in PowerShell. You can find them here:
http://www.quest.com/activeroles-server/arms.aspx

--
Kirk Munro
Poshoholic
http://poshoholic.com


<techjohnny@xxxxxx> wrote in message
news:7f9d985e-f13b-423b-8d01-8ee0d486b84a@xxxxxx
Quote:

> I'm running Windows Powershell 1.0 and would like to know of a way to
> scan our network of 50+ computers in an ADSI OU to remove certain
> files from their desktop?
>
> I'm trying to remove all shortcuts to a program that no longer exist,
> and it begins with the characters Vista 8.03.
>
> Any help would be great.
>
> Thanks,
>
> --TJ

My System SpecsSystem Spec
Old 11-29-2007   #3 (permalink)
Kirk Munro


 
 

Re: Searching and removing files from an OU.

It seems that the editor I am using decided to try and treat it as a path.
Here's a substring of the middle of the Path property I listed in my
original post:

....$($_.Name)\c$\Documents and Settings\*\Desktop\...

I should also mention that once you install the Quest AD cmdlets, you'll
have to add them to PowerShell to be able to call Get-QADComputer using the
following command:

Add-PSSnapin Quest.ActiveRoles.ADManagement

Please let me know how it works out for you.

--
Kirk Munro
Poshoholic
http://poshoholic.com


"Kirk Munro" <sorry@xxxxxx> wrote in message
news:ePhjOorMIHA.1164@xxxxxx
Quote:

> Hi TJ,
>
> That's a great request, and PowerShell definitely is the right tool for
> the job.
>
> Assuming that you're running in the context of an administrator of these
> 50+ computers, you could do this:
>
> Get-QADComputer -SearchRoot 'company.com/ComputersOU' | ForEach-Object {
> Remove-Item -Path "\\$($_.Name)\c$\Documents and
> Settings\*\Desktop\Vista 8.03*" -WhatIf
>
> }
>
> Note that I added -WhatIf to show you what the script will do before you
> actually run it. This supports multiple profiles on each computer, and
> assumes that the profiles are all stored on the C drive and that you have
> an administrative share on that drive.
>
> Also note that this uses Quest's AD cmdlets. These cmdlets are free and
> simplify working with AD in PowerShell. You can find them here:
> http://www.quest.com/activeroles-server/arms.aspx
>
> --
> Kirk Munro
> Poshoholic
> http://poshoholic.com
>
>
> <techjohnny@xxxxxx> wrote in message
> news:7f9d985e-f13b-423b-8d01-8ee0d486b84a@xxxxxx
Quote:

>> I'm running Windows Powershell 1.0 and would like to know of a way to
>> scan our network of 50+ computers in an ADSI OU to remove certain
>> files from their desktop?
>>
>> I'm trying to remove all shortcuts to a program that no longer exist,
>> and it begins with the characters Vista 8.03.
>>
>> Any help would be great.
>>
>> Thanks,
>>
>> --TJ
>
>

My System SpecsSystem Spec
Old 11-29-2007   #4 (permalink)
techjohnny


 
 

Re: Searching and removing files from an OU.

On Nov 29, 11:53 am, "Kirk Munro" <so...@xxxxxx> wrote:
Quote:

> It seems that the editor I am using decided to try and treat it as a path.
> Here's a substring of the middle of the Path property I listed in my
> original post:
>
> ...$($_.Name)\c$\Documents and Settings\*\Desktop\...
>
> I should also mention that once you install the Quest AD cmdlets, you'll
> have to add them to PowerShell to be able to call Get-QADComputer using the
> following command:
>
> Add-PSSnapin Quest.ActiveRoles.ADManagement
>
> Please let me know how it works out for you.
>
> --
> Kirk Munro
> Poshoholichttp://poshoholic.com
>
> "Kirk Munro" <so...@xxxxxx> wrote in message
>
> news:ePhjOorMIHA.1164@xxxxxx
>
Quote:

> > Hi TJ,
>
Quote:

> > That's a great request, and PowerShell definitely is the right tool for
> > the job.
>
Quote:

> > Assuming that you're running in the context of an administrator of these
> > 50+ computers, you could do this:
>
Quote:

> > Get-QADComputer -SearchRoot 'company.com/ComputersOU' | ForEach-Object {
> > Remove-Item -Path "\\$($_.Name)\c$\Documents and
> > Settings\*\Desktop\Vista 8.03*" -WhatIf
>
Quote:

> > }
>
Quote:

> > Note that I added -WhatIf to show you what the script will do before you
> > actually run it. This supports multiple profiles on each computer, and
> > assumes that the profiles are all stored on the C drive and that you have
> > an administrative share on that drive.
>
Quote:

> > Also note that this uses Quest's AD cmdlets. These cmdlets are free and
> > simplify working with AD in PowerShell. You can find them here:
> >http://www.quest.com/activeroles-server/arms.aspx
>
Quote:

> > --
> > Kirk Munro
> > Poshoholic
> >http://poshoholic.com
>
Quote:

> > <techjoh...@xxxxxx> wrote in message
> >news:7f9d985e-f13b-423b-8d01-8ee0d486b84a@xxxxxx
Quote:

> >> I'm running Windows Powershell 1.0 and would like to know of a way to
> >> scan our network of 50+ computers in an ADSI OU to remove certain
> >> files from their desktop?
>
Quote:
Quote:

> >> I'm trying to remove all shortcuts to a program that no longer exist,
> >> and it begins with the characters Vista 8.03.
>
Quote:
Quote:

> >> Any help would be great.
>
Quote:
Quote:

> >> Thanks,
>
Quote:
Quote:

> >> --TJ
Awesome! Works as described.

Thanks,

--TJ
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
RE: Searching for files Vista General
Re: Searching for files Vista General
Searching for files Vista General
searching files Vista General
removing associated Norton files form windows security as it still appears in security centre after removing from registry, application common folders etc Vista security


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46