# Running a script as a different user

**URL:** <https://forums.powershell.org/t/running-a-script-as-a-different-user/21127>\
**Category:** PowerShell Help\
**Created:** [December 9, 2022, 10:23pm UTC](https://forums.powershell.org/t/running-a-script-as-a-different-user/21127 "2022-12-09T22:23:00Z")\
**Posts on this page:** 3\
**Page:** 2

<div class="post-metadata">

**Author:** ![matt1974](https://avatars.discourse-cdn.com/v4/letter/m/dbc845/32.png) [@matt1974](https://forums.powershell.org/u/matt1974)\
**Post date:** [December 13, 2022, 10:49pm UTC](https://forums.powershell.org/t/running-a-script-as-a-different-user/21127/21 "2022-12-13T22:49:11Z")

</div>

Hello,  
I read all about hash tables and pscustom objects, but Im still confused on that part of the script.

I understand that this line

```auto
[PSCustomObject]$ResultHashtable

```

makes the hashtable a custom object. Thats awesome, now can pipe it to .csv files and it still looks nice.

I commented out that line, expecting to still see the hashtable as output, but I see nothing as output. How come I dont see anything output whenn that line is commented out?

Thanks!

---

<div class="post-metadata">

**Author:** ![Olaf](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/olaf/32/992_2.png) [@Olaf](https://forums.powershell.org/u/Olaf)\
**Post date:** [December 13, 2022, 11:57pm UTC](https://forums.powershell.org/t/running-a-script-as-a-different-user/21127/22 "2022-12-13T23:57:07Z")

</div>

> [@matt1974](#):
>
> I understand that this line
> 
> ```auto
> [PSCustomObject]$ResultHashtable
> 
> ```
> 
> makes the hashtable a custom object.

You might have a misconception about this command in your mind.

Yes - it creates a `[PSCustomObject]` **A N D** outputs it ! ! !

When you remove the only output producing line of code from your code you don’t have any output anymore. 🤷🏽‍♂️

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:16pm UTC](https://forums.powershell.org/t/running-a-script-as-a-different-user/21127/23 "2024-05-16T20:16:15Z")

</div>



[Previous page](https://forums.powershell.org/t/running-a-script-as-a-different-user/21127.md?page=1)
