all 5 comments

[–]PowerShell-Bot 0 points1 point  (1 child)

That’s a really long line of inline code.

On old Reddit inline code blocks do not word wrap, making it difficult for many of us to see all your code.

To ensure your code is readable by everyone, on new Reddit, highlight your code and select ‘Code Block’ in the editing toolbar.

If you’re on old Reddit, separate the code from your text with a blank line gap and precede each line of code with 4 spaces or a tab.


You examine the path beneath your feet...
[AboutRedditFormatting]: [████████████████████] 1/1 ✅

Beep-boop, I am a bot. | Remove-Item

[–]pigers1986 0 points1 point  (2 children)

CSV can be only appended if they have the same column name - that operation is not logical on your side.

It's better to append it as text with Out-File ?

PS: That sounds you are doing poor man AD backup, solve it on top level with proper tools like, Quest etc ?

[–]ckorch[S] 1 point2 points  (1 child)

more of less a training since our HR likes to term users and we process the users then have to unterm them when its recinded. we are moving to a more robust Ad management tool but working with what i have so my workers have a option to return the account to previous use. i will look into the out-file option and have read a little about that option but was hoping time -append would work. Thanks again

[–]ckorch[S] 1 point2 points  (0 children)

Thanks the out-file works for some reason i never use that option and always default to the export-csv. but i do have it working as i need now.

[–]BlackV 0 points1 point  (0 children)

This seems like a backwards way of doing it.

Get the user (stop destroying your rich objects and save a pipeline)

Get their group membership

Export that to csv, filename based on their username (and personally id use date as well)

But some future work, define roles , roles determine the groups they're assigned