# Set-Service Logons

**URL:** <https://forums.powershell.org/t/set-service-logons/23996>\
**Category:** PowerShell Help\
**Created:** [April 24, 2024, 5:57pm UTC](https://forums.powershell.org/t/set-service-logons/23996 "2024-04-24T17:57:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dalebert](https://avatars.discourse-cdn.com/v4/letter/d/f17d59/32.png) [@dalebert](https://forums.powershell.org/u/dalebert)\
**Post date:** [April 24, 2024, 5:57pm UTC](https://forums.powershell.org/t/set-service-logons/23996/1 "2024-04-24T17:57:04Z")

</div>

I have a WinForm I’m creating to manage a bunch of stuff. One of those things is to modify services. But I can’t seem to find a way to set the logon UID and PWD by using values supplied in my WinForm by the end user.

The only way I’ve found to set the UID and PWD for a service is to use:

```auto
$Cred = Get-Credential
Set-Service -ComputerName Server1 -Name Spooler -Credential $Cred

```

Does anyone know if there is a way to set the logon ID and password using Set-Service, but NOT using the Get-Credential? Perhaps something with WMI, maybe even with SC.exe?

Thanks,  
Dale

---

<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:** [April 24, 2024, 7:07pm UTC](https://forums.powershell.org/t/set-service-logons/23996/2 "2024-04-24T19:07:41Z")

</div>

I googled it for you:

[https://www.google.com/search?as\_q=powershell+create+credentials](https://www.google.com/search?as_q=powershell+create+credentials)

the first hit was this:

> **[PowerShell Create Credential Object](https://pscustomobject.github.io/powershell/howto/PowerShell-Create-Credential-Object/)**
>
> There are many cmdlets that take a PSCredential object to run under the context of that specific user.

---

<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 8, 2024, 4:34am UTC](https://forums.powershell.org/t/set-service-logons/23996/3 "2024-05-08T04:34:38Z")

</div>


