creating service accounts in windows server 2008 R2 - active-directory

How can I create a service account such as SQL service in active directory on Win server 2008 R2?
I dont know in which part of administrative tools that it can be found.

First Confirm that the Managed Users Service Account Container exists using the MMC Active Directory Groups and Users tool:
Second Use Windows PowerShell to create the accounts by running the two commands in lines steps 5 & 6 below:
Click Start
Click All Progams
click Windows PowerShell 2.0, and
then click the Windows PowerShell icon.
Run the following command: Import-Module ActiveDirectory
Run the following command: New-ADServiceAccount [-SAMAccountName ] [-Path ].
If you omit the parameters, the power shell will provide prompts that allow you to supply the name.
That't all there is to it.

Related

Access office 365 authentication popup of PowerShell from Windows Form/WPF

I have a following PowerShell script, this scripts connects to my Azure Analysis services. As I execute following script, it opens a popup like image below.
param(
[String]
$envName1
)
$loadInfo1 = [Reflection.Assembly]::LoadWithPartialName("Microsoft.AnalysisServices")
$server1 = New-Object Microsoft.AnalysisServices.Server
$server1.Connect($envName1)
return $server1
Problem is that I want to execute this PowerShell from my WPF application. I don't understand, how can I access this Popup in my WPF application.
I'm not too sure what you mean by that. However, you need an account to connect to Azure, maybe you signed out or never actually signed in to Visual Studio.
Edit: I finally understand what you mean (slightly). So there are basically two solutions. First one is Azure AD. To connect to Office 355 with PowerShell using the AzureAD module, you’ll first need to install it. You can do so by running Install-Module AzureAD from an administrative PowerShell session. Once you have the module installed, run the Connect-AzureAD cmdlet. Once you do, PowerShell will prompt for your Microsoft ID and password (Work or school account). Once authenticated, you’ll be able to use all of the commands in the module.
Connecting to Office 365 with the MSOnline Module:
Connecting to Office 365 with PowerShell using the MSOnline module requires a little bit more effort. Assuming you have the Microsoft Online Services Sign-In Assistant for IT Professionals RTW software package installed:
Install the MSOnline module from the PowerShell Gallery by running from an administrative PowerShell console:
Install-Module MSOnline (Function)
Once the module is installed, run Get-Module to ensure PowerShell can find the module.
Finally, run the Connect-MsolService cmdlet to authenticate to Azure AD. This will prompt you for your Office 365 credential.

How to enable sa login when doing an unattended install of SQL Server 2014 Express?

I have an installer that's running the SQL Server 2014 Express installer in unattended mode.
Basically, it's creating a command-line and running the setup.
My problem is that I need to be able to connect to the installed instance as admin using SQL Server authentication.
The command-line already contains /SECURITY MODE=SQL. I can create a SQL login and login successfully, so that part of the problem works fine.
My problem is that while I can see sa in sys.server_principals, it's flagged as is_disabled, and I can't login using it.
Is there a way, when running the SQL Server 2014 install unattended, to pass command line arguments that will have it enable sa so I can successfully login using it?
Or some other login, if that's easier.
What I need is a sql_login that I can use to connect to the database as an db administrator without regard for the permissions of the logged-in windows user, after having run the installer in unattended mode.
The full commandline args:
/QS /IACCEPTSQLSERVERLICENSETERMS /ACTION=Install /FEATURES=SQL
/INSTANCENAME=SQLEXPRESS /SAPWD="SQLSVCPASSWORD"
If I login to Windows using an admin account, I can connect to the database using Windows authentication. I can then create a normal SQL Server login. With that, I can then login using SQL Server authentication and that account.
So I'm certain the DB is in mixed mode. And this:
Exec xp_instance_regread N'HKEY_LOCAL_MACHINE', N'Software\Microsoft\MSSQLServer\MSSQLServer', N'LoginMode'
returns '2'.
My problem is that I need the users to be able to run the software without being a windows admin. And part of what the software needs to be able to do is to drop and create databases, within the instance.
So I need SQL admin permissions, without depending upon the windows user having elevated permissions.
===
The setup tool I'm using is configured using XML files that contain, in them, LUA scripts that build and run the Windows Installer package command lines. Between the nested languages and various levels of escaping, I'd not noticed that the "/SECURITYMODE=SQL" argument was commented out, and not included in the command line.
With it included in the command line, the "sa" user is enabled.
TL;RD If you want the "sa" user enabled, after an install, include "/SECURITYMODE=SQL" on the command line.
You need to specify /SAPWD as well when using /SECURITYMODE=SQL. I am not sure, but if you do not specify the password, it will be disabled by default.
Have a look at this article https://learn.microsoft.com/en-us/sql/database-engine/install-windows/install-sql-server-from-the-command-prompt?view=sql-server-2017 for more information.

Use windows authentication in windows service

When running tomcat 7 as a windows service I can connect SQLServer with SQLServer Authentication but when connecting through Windows Authentication it seems to fail.
From what I know process running under windows services are user independent and run under a user named "SYSTEM" . Is there a way I can add SYSTEM to SQLServer users ?
Every thing seems to work if I run the code via Eclipse i.e. Under a user process.
You need to add a new Login of your Machine (Machine where your service is running) on MS SQL Server machine.
For example your are on domain "DomainName" and your hostname is "MachineName", you need to add a new Login "DomainName\MachineName$" on SQL Server. Note the $ sign at the end indicates that this is a computer name.
Follow the Steps below to add a new login on MS SQL Server:
Open SQL Server Management Studio and Login as 'sa' user.
Open Security -> Logins
Right Click on Logins and New Login...
Enter the Login name "DomainName\MachineName$" in General Tab
Select Windows Authentication radio box
Select tab "Server Roles" and check the box against "sysadmin"
OK and then Restart your SQL Server Service.

PowerShell AD on server or desktop?

I'm starting out on creating PowerShell scripts for my company. I'm new the the platform and I plan on creating scripts for AD tasks
If im creating scripts for AD should I be able to run the script on any machine in the domain or does the script have to be run on a machine that is the active directory server?
I don't mind running the script on the server but for testing and creating I would rather run it on my desktop for development and testing
any incite on this?
Assuming you're using the activedirectory powershell module, then the only requirement is that the machine you're running the script on has this module installed.
This module is a windows feature "Remote Server Administration Tools > Role Administration Tools > AD DS and AD LDS Tool > Active Directory Module for Windows Powershell."
On a server OS, this can be simply added as a feature through Server Manager
On a client OS, you will first need to install the Remote Server Administration Tools (RSAT) from Microsoft download centre. Once that is installed, you then install the feature through "Turn Windows Features on or off"
Additionally, if your script has a dependency on this module, you can also place the following line at the top of your script
#Requires -Module activedirectory
Then if you try to run this script on a machine without the activedirectory module, it'll produce an error saying the module is missing. It'll also cause the activedirectory module to be imported if it's not already been imported which is useful on powershell. Refer to about_Requires for more information on the #Requires statement

connect to remote sql server with different windows credentials

Is there a way to connect to a remote sql server using management studio with windows credentials other than the current
login credentials?
Right now i remote desktop into the sql server machine and login with the windows credentials that I want to connect with.
Thanks.
Right click the application and choose "Run as different user".
If you are on Vista or Win7, you may need to look at ShellRunAs to create the menu option in your windows shell.
Another alternative in Windows 7 is to use command prompt running as alternative user
runas /user:domain\username CMD
this will start command shell that you can use to launch SSMS application. This approach is also helpful because as long as that instance of "command prompt" is running, you can start and test different applications as they function under that user without having to retype the credentials

Resources