Unable to login after running a powershell/batch script to add new usercmd to powershell transition in...
Is this apparent Class Action settlement a spam message?
Inappropriate reference requests from Journal reviewers
Failed to fetch jessie backports repository
How to write papers efficiently when English isn't my first language?
Proof of work - lottery approach
What happens if you roll doubles 3 times then land on "Go to jail?"
Short story about space worker geeks who zone out by 'listening' to radiation from stars
How does the UK government determine the size of a mandate?
Class Action - which options I have?
Why escape if the_content isnt?
Is `x >> pure y` equivalent to `liftM (const y) x`
Why does indent disappear in lists?
Trouble understanding the speech of overseas colleagues
How do I find the solutions of the following equation?
Why didn't Theresa May consult with Parliament before negotiating a deal with the EU?
Why not increase contact surface when reentering the atmosphere?
How do I go from 300 unfinished/half written blog posts, to published posts?
What is the intuitive meaning of having a linear relationship between the logs of two variables?
Why, precisely, is argon used in neutrino experiments?
Was Spock the First Vulcan in Starfleet?
Opposite of a diet
Can the discrete variable be a negative number?
What does "I’d sit this one out, Cap," imply or mean in the context?
Is there a problem with hiding "forgot password" until it's needed?
Unable to login after running a powershell/batch script to add new user
cmd to powershell transition in batch-scriptThe User Profile Service service failed the sign-inWindows Store not recognizing Admin privilegesStandard user account for Windows 8.1 is created, but cannot loginrunning batch file within powershellHow to remove an account?Why access denied for user within permitted group?Windows 10 PowerShell script doesn't run with Task Scheduler trigger set for logon or logoffPowerShell script stops after running If statementPowershell script won't launch in task scheduler when running as my admin user
Our (quite small) environment has Windows (8.1 and 7) machines with user accounts that have admin privileges. To fix this, I decided to write a powershell script which would add a new admin account and demote the current one. After running it, I could no longer login into anything. The script is simple:
If (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator"))
{
Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs;
exit
}
net user local_admin SuperSecurePassword /add /comment:"comment" /expires:never
net localgroup "Administrators" local_admin /add
net localgroup "Administrators" "$env:username" /delete
Read-Host -Prompt "Enter!"
First, it relaunches from an elevated PS instance (taken from a popular question on SE), then runs the commands themselves.
All commands reported success on execution ("Command succesful" or something like that). However, I could no longer login into the system (not with the new profile, not with the old one) with this error message:
The User Profile Service service failed the logon. User profile cannot be loaded.
We have no domain, just a bunch of PCs with local accounts (I know, I know). What am I doing wrong?
windows-8 windows-8.1 powershell batch
New contributor
add a comment |
Our (quite small) environment has Windows (8.1 and 7) machines with user accounts that have admin privileges. To fix this, I decided to write a powershell script which would add a new admin account and demote the current one. After running it, I could no longer login into anything. The script is simple:
If (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator"))
{
Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs;
exit
}
net user local_admin SuperSecurePassword /add /comment:"comment" /expires:never
net localgroup "Administrators" local_admin /add
net localgroup "Administrators" "$env:username" /delete
Read-Host -Prompt "Enter!"
First, it relaunches from an elevated PS instance (taken from a popular question on SE), then runs the commands themselves.
All commands reported success on execution ("Command succesful" or something like that). However, I could no longer login into the system (not with the new profile, not with the old one) with this error message:
The User Profile Service service failed the logon. User profile cannot be loaded.
We have no domain, just a bunch of PCs with local accounts (I know, I know). What am I doing wrong?
windows-8 windows-8.1 powershell batch
New contributor
add a comment |
Our (quite small) environment has Windows (8.1 and 7) machines with user accounts that have admin privileges. To fix this, I decided to write a powershell script which would add a new admin account and demote the current one. After running it, I could no longer login into anything. The script is simple:
If (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator"))
{
Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs;
exit
}
net user local_admin SuperSecurePassword /add /comment:"comment" /expires:never
net localgroup "Administrators" local_admin /add
net localgroup "Administrators" "$env:username" /delete
Read-Host -Prompt "Enter!"
First, it relaunches from an elevated PS instance (taken from a popular question on SE), then runs the commands themselves.
All commands reported success on execution ("Command succesful" or something like that). However, I could no longer login into the system (not with the new profile, not with the old one) with this error message:
The User Profile Service service failed the logon. User profile cannot be loaded.
We have no domain, just a bunch of PCs with local accounts (I know, I know). What am I doing wrong?
windows-8 windows-8.1 powershell batch
New contributor
Our (quite small) environment has Windows (8.1 and 7) machines with user accounts that have admin privileges. To fix this, I decided to write a powershell script which would add a new admin account and demote the current one. After running it, I could no longer login into anything. The script is simple:
If (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator"))
{
Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs;
exit
}
net user local_admin SuperSecurePassword /add /comment:"comment" /expires:never
net localgroup "Administrators" local_admin /add
net localgroup "Administrators" "$env:username" /delete
Read-Host -Prompt "Enter!"
First, it relaunches from an elevated PS instance (taken from a popular question on SE), then runs the commands themselves.
All commands reported success on execution ("Command succesful" or something like that). However, I could no longer login into the system (not with the new profile, not with the old one) with this error message:
The User Profile Service service failed the logon. User profile cannot be loaded.
We have no domain, just a bunch of PCs with local accounts (I know, I know). What am I doing wrong?
windows-8 windows-8.1 powershell batch
windows-8 windows-8.1 powershell batch
New contributor
New contributor
New contributor
asked 2 mins ago
AtmaksAtmaks
1
1
New contributor
New contributor
add a comment |
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Atmaks is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1418476%2funable-to-login-after-running-a-powershell-batch-script-to-add-new-user%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Atmaks is a new contributor. Be nice, and check out our Code of Conduct.
Atmaks is a new contributor. Be nice, and check out our Code of Conduct.
Atmaks is a new contributor. Be nice, and check out our Code of Conduct.
Atmaks is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1418476%2funable-to-login-after-running-a-powershell-batch-script-to-add-new-user%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown