Hi there,
Is there no support for New-LocalUser Cmdlet in PowerShell 7.3.6 ? I get this error message
Password: ************
New-LocalUser: Could not load type ‘Microsoft.PowerShell.Telemetry.Internal.TelemetryAPI’ from assembly ‘System.Management.Automation, Version=7.3.6.500, Culture=neutral, PublicKeyToken=31bf3856ad364e35’
Get-LocalUser -Name ‘jason’ works just fine ?
kind regards,
Jason
Hi, welcome to the forum
Appears to have been acknowledged as a known problem on the issue you raised (I assume it’s you as the username is the same).
opened 07:05PM - 20 Nov 22 UTC
closed 10:01PM - 22 Nov 22 UTC
Resolution-External
### Prerequisites
- [X] Write a descriptive title.
- [X] Make sure you are able… to repro it on the [latest released version](https://github.com/PowerShell/PowerShell/releases)
- [X] Search the existing issues.
- [X] Refer to the [FAQ](https://github.com/PowerShell/PowerShell/blob/master/docs/FAQ.md).
- [X] Refer to [Differences between Windows PowerShell 5.1 and PowerShell](https://docs.microsoft.com/powershell/scripting/whats-new/differences-from-windows-powershell).
### Steps to reproduce
To reproduce :
Open PowerShell 7.3 X64 . (latest)
Run the `New-LocalUser` Cmdlet
### Expected behavior
```console
Creation of Local User
```
### Actual behavior
```console
We get this error and the user does not get created.
New-LocalUser: Could not load type 'Microsoft.PowerShell.Telemetry.Internal.TelemetryAPI' from assembly 'System.Management.Automation, Version=7.3.0.500, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
```
### Error details
```console
Exception :
Type : System.TypeLoadException
Message : Could not load type 'Microsoft.PowerShell.Telemetry.Internal.TelemetryAPI' from assembly 'System.Management.Automation, Version=7.3.0.500, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
TypeName : Microsoft.PowerShell.Telemetry.Internal.TelemetryAPI
TargetSite :
Name : ProcessRecord
DeclaringType : Microsoft.PowerShell.Commands.NewLocalUserCommand
MemberType : Method
Module : Microsoft.PowerShell.LocalAccounts.dll
Source : Microsoft.PowerShell.LocalAccounts
HResult : -2146233054
StackTrace :
at Microsoft.PowerShell.Commands.NewLocalUserCommand.ProcessRecord()
at System.Management.Automation.CommandProcessor.ProcessRecord()
CategoryInfo : NotSpecified: (:) [New-LocalUser], TypeLoadException
FullyQualifiedErrorId : System.TypeLoadException,Microsoft.PowerShell.Commands.NewLocalUserCommand
InvocationInfo :
MyCommand : New-LocalUser
ScriptLineNumber : 1
OffsetInLine : 1
HistoryId : 6
Line : new-LocalUser -Name login2
PositionMessage : At line:1 char:1
+ new-LocalUser -Name login2
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
InvocationName : new-LocalUser
CommandOrigin : Internal
ScriptStackTrace : at <ScriptBlock>, <No file>: line 1
```
### Environment data
```powershell
Name Value
---- -----
PSVersion 7.3.0
PSEdition Core
GitCommitId 7.3.0
OS Microsoft Windows 10.0.22621
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
```
### Visuals
_No response_
I can’t replicate it myself though, it creates the user without any errors on my Windows 10 machine:
PS E:\Temp> New-LocalUser -Name 'testUser1'
cmdlet New-LocalUser at command pipeline position 1
Supply values for the following parameters:
Password: ********
Name Enabled Description
---- ------- -----------
testUser1 True
PS E:\Temp> $PSVersionTable
Name Value
---- -----
PSVersion 7.3.6
PSEdition Core
GitCommitId 7.3.6
OS Microsoft Windows 10.0.19045
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
2 Likes
system
Closed
February 10, 2024, 5:34pm
3
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.