Skip to content

Any windows Powershell experts here?

Featured Replies

Powershell isn't my strong point and I need a bit of help.

I've got a script that generates a list of files on a PC and exports them to a network location which works fine with a fixed file name for the output.

Get-ChildItem -Path C:\Users,D:\ -Recurse | Select-Object -Property @{l='ComputerFullName';e={"\\$($env:computername)\$($_.FullName -Replace ':','$')"}} |Export-Csv -Path '\\fileserver\Codir\Internal IT\Restricted\Output files\output.csv' –NoTypeInformation

That's no good for us though, as we need to run this on several machines and add in the computer name to the output file so we can tell them apart.

We've tried this, but it errors as we obviously don't have the syntax quite right.

Get-ChildItem -Path C:\Users,D:\ -Recurse | Select-Object -Property @{l='ComputerFullName';e={"\\$($env:computername)\$($_.FullName -Replace ':','$')"}} |Export-Csv -Path '\\fileserver\Codir\Internal IT\Restricted\Output files\" + $env:computername + " output.csv' –NoTypeInformation

A virtual pint for anyone who can get it right for us....

Thanks

Think the export-csv just needs to be thus:

Export-Csv -Path "\\fileserver\Codir\Internal IT\Restricted\Output files\$env:computername output.csv" –NoTypeInformation

(works for me, anyway :) )

  • Author

Cheers.

I'll give it a go in the morning

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Important Information

Welcome to BRISKODA. Please note the following important links Terms of Use. We have a comprehensive Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.

Account

Navigation

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.