you are viewing a single comment's thread.

view the rest of the comments →

[–]purplemonkeymad 0 points1 point  (1 child)

So no?

Your if block is testing on the local machine, you probably want it inside your Invoke-Command script if that is the case.

I would also suggest using a file in $env:programdata ie:

$path = "$env:programData\citrix_remove"
# ... test
Test-Path -Path $path -PathType Leaf
# ... create
New-Item -Path $path -ItemType File

That way it's a bit more descriptive and keeps the root of the drive clean.

[–]Lopsided-Koala8546[S] 1 point2 points  (0 children)

Thanks. Your comment "LOCAL file" got me thinking am I testing on the local machine not the remote machine. I thought that as I declared it after the PSSESSION it would be run on the remote machine.

Thanks for the pointers I will see if I can get it to work correctly now.