How To map a network Drive through preferences by using wmi query in server 2008 - windows-server-2008

I want to map a network drive through preferences option. For this mapping i want to go with wmi query, which is in item level targeting, I done with all the initial work like giving its path, drive letter etc. Now i gone to common tab and selected item level targeting. In which i selected wmi query and i wrote the query as
select username from win32_ComputerSystem where domain="www.test.com".
I am running windows server 2008, my domain is www.test.com and i am using windows 7 machine as client of my server. After applying the preferences i ran gpupdate /force also on client an then log off and log on but i am not getting the network drive on my client. Did I wrote the wmi query wrong or anything else?

Related

How to find new server name and why the last not working

I have Microsoft SQL Server 2016. I used to go in with a server name and there was no problem.
Recently there was a problem with the boot file, also known as the 0x00000034 blue screen error.
After the patch, it does not let enter the local server name.
Before
but the result
I tried other names and also examined similar questions without any good results.
for example-
How to find server name of SQL Server Management Studio and also How to find server name of SQL Server Management Studio but without any success.
There might be an issue with the connection to the server instance. I would try the troubleshooting steps in the question and answer from this post How do I fix the error 'Named Pipes Provider, error 40 - Could not open a connection to' SQL Server'? or from this video https://www.youtube.com/watch?v=810cv3PunkA
The server name, that you enter there is the name of the computer, on which the SQL Server has been installed. This is called "default instance", because you do not specify a name of the instance, which is in the format "computer_name\instance_name". If you are trying to connect to an instance (either default or named) installed on your local computer, you can substitute computer_name with . (dot), i.e. you can connect to a default instance on your computer by giving ., or to a named instance as .\SQLEXPRESS for example.
So in your case if you specify only a dot for server name, you should be able to connect. If you don't connect, then the SQL Server instance is not working. You can check is the service started, but you may have to reinstall SQL Server.
If the connection is successful, then you can keep using . (or (local)). If you want to find your computer's name, from Windows Explorer right click This PC and select Properties, then look at Computer name:.
If you still can't connect to the SQL Server using this computer name, then you have issues not related to the SQL Server engine itself. Open a command prompt and try to ping the computer name: ping desktop-7t2s4sm. If you get an error, then you have a networking issue.
Press ⊞ Win + R or type run in start (open run)
Type services.msc
Look for SQL Server (MSSQLSERVER)
Right click on it
Click on start

Cannot attach database SQL Server 2012 error 5

When I type this:
CREATE DATABASE AdventureWorks2012
ON (FILENAME = 'C:\Users\sohm\Desktop\Pohm\AdventureWorks2012_Data.mdf')
FOR ATTACH_REBUILD_LOG ;
I get this:
File activation failure. The physical file name
"C:\Users\sohm\Desktop\AdventureWorks2012_Data_log.ldf" may be incorrect.
Msg 5123, Level 16, State 1, Line 1
CREATE FILE encountered operating system error 5 (Access is denied.) while attempting to
open or create the physical file 'C:\adventuredb\AdventureWorks2012_Data_log.ldf'.
Msg 1813, Level 16, State 2, Line 1
Could not open new database 'AdventureWorks2012'. CREATE DATABASE is aborted.
I know it has to do with permissions. I have the administrator account. I have read a million posts but nothing has worked so far. Also when I try to change the folder containing the mdf file, to full control but it keeps reverting back to read-only.
You should run SSMS as an administrator.
Also it is possible that you might be running query as an 'sa' user(sql server authentication).
Try running the query with windows Authentication.
SHORT VERSION
For allowing MS SQL server 2012 to attach the database files you must grant full access to the mdf and ldf files to:
NT Service\MSSQLSERVER
Full Access
LONG VERSION
SQL Security has been updated a lot in 2012 handling of files.
http://technet.microsoft.com/en-us/library/ms189128.aspx
If you look at the existing attached databases and there security you will probably see that there only are 2 roles allowed with full access. MSSQLSERVER and Administrators, when attached SQL Removes all other roles from the files.
Trying to set the MSSQLSERVER from the fil security Permission will not work.
Looking at your services.msc overview you will in a default install see that NT Service\MSSQLSERVER also runs the SQL server servics.
The service account is not visible, the same issue as with IIS AppPools, a sub group has been created by the system and "hides" the accounts from auto discovery, probably to try and secure the accounts but in my view just obscures the setup.
Regards Jan
Open the SQL Server Management Stdio in Administrator mode(Right click -> Select Run as Administrator. If it asks for User name and password enter your Administrator user name password). Then select Windows Authentication click ok, and now try to attache it will attache without any error.
This has nothing to do with YOUR account. SQL Server is trying to write to that folder under the context of the service account that is running SQL Server. You can see who this is by going to the Services applet and seeing who the instance runs as (probably NT AUTHORITY\SYSTEM or whatever). You can override that or you can place your MDF files in the data folder, which SQL Server already has inherent access to, instead of placing them in this other location on your C:\ drive.
Another way to solve this is to change all the SQL Server services to Local System Account instead of services. Start -> Run ->Services.msc -> Scroll down to SQL Server, you should see five services that start with SQL Server. Right-Click, Properties, Log On, change to Local System Account. Repeat for all the rest of the SQL Server Services and restart them all.
Try This
Go to the folder where you have stored mdf file.
Select file -> Right click -> click on mdf give full permissions to file for logged in user Security.
If still issue persist and it might me because of corrupted transaction logs, you may use tool SQL Database Recovery Tool Repairs to repair your corrupted mdf file.
Figured it out. I went to sql server configuration manager and right clicked SQL Server Service. Then I added my Windows Admin account to run the service and now it works.

How to find the global catalog of my network in ADDC?

I'm learning IT right now, and I have this situation.
The employee who was the administrator, got out of the company. But he doesn't leave a documentation to tell me which of my ADDC (Active Directory Domain Controller) is the PDC, I mean I'm interested to fin the global catalog and structure of my network.
Does you know a post from TechNet or some site to find this PDC in Windows Server 2008 R2?
You can either open Active Directory Sites and services, expand sites -> servers and look at the NTDS settings of each server you have, there will be a tick box on the general tab that will be checked if the server is a global catalog.
Alternatively, if you have quite a lot of servers and don't want to have to do this for each one, you can use nslookup:
Find a list of global catalogs using nslookup
As for PDC though, these haven't really existed since windows NT, there is however a PDC emulator FSMO role which is held by one domain controller that you can find using the following command:
dsquery server -hasfsmo pdc
You can see the other FSMO roles here:
Identify Operations Master Roles
You can display the Global Catalog Servers in the domain you are logged in to using Nslookup.exe:
Open a CMD.EXE window.
Type the following command and press Enter:
nslookup gc._msdcs.%USERDNSDOMAIN%
Run the following from a command promt:
nslookup
set type=serv
_gc._tcp."FQDN"

Rename Sharepoint Central admin machine name in SharePoint 2010 farm

This might be wrong place to ask this question.
I spent effort in setting up thr sharepoint 2010 2 tier farm. I have settled up the sql server databases required for sharepoint, installed on different machine. and sharepoint on another machine. it took around 6 days, but at the end i noticed that i have computer name with something "win43453-676" like this. where as my manager wants to to keep relavant name like "CentralAdminMachine" of central admin pc. if i changed the name of machine , i am unable to open even central administration site. is there any remedy to change this name in configuration database and all....?
There is both a PowerShell cmdlet and an STSADM command that allow you to change the server name. Both require that you first change the name through the standard Windows System control panel. After that (and a restart) you can use:
Rename-SPServer [-Identity] <OriginalServerName> -Name <NewServerName>
http://technet.microsoft.com/en-us/library/cc263117(office.12).aspx
or
Rename-SPServer [-Identity] <SPServerPipeBind> -Name <String> [-AssignmentCollection <SPAssignmentCollection>] [-Confirm [<SwitchParameter>]] [-WhatIf [<SwitchParameter>]]
http://technet.microsoft.com/en-us/library/ff607556.aspx
There are some people who seem to recommend the STSADM (even though PowerShell is the Microsoft recommend way on SharePoint 2010) because it seems to work and not the give error that the PowerShell command does about feature dependency, but it looks like you can try either one.
And you may need to update your alternate access mappings to enable any custom URLs to work as well.

Connect different Windows User in SQL Server Management Studio (2005 or later)

Is there a way in SQL Server Management Studio 2005 (or later) to change the Windows Authentication user (as you could in SQL Server 2000 and older)?
This is the general connection properties dialog(note the greyed out UID/PWD when selecting Windows Auth):
FYI - One workaround is to use runas but I'm looking for a solution that will allow me to work with multiple Windows accounts across multiple servers (and across multiple domains).
While there's no way to connect to multiple servers as different users in a single instance of SSMS, what you're looking for is the following RUNAS syntax:
runas /netonly /user:domain\username program.exe
When you use the "/netonly" switch, you can log in using remote credentials on a domain that you're not currently a member of, even if there's no trust set up. It just tells runas that the credentials will be used for accessing remote resources - the application interacts with the local computer as the currently logged-in user, and interacts with remote computers as the user whose credentials you've given.
You'd still have to run multiple instances of SSMS, but at least you could connect as different windows users in each one.
For example: runas /netonly /user:domain\username ssms.exe
Hold shift and right click on SQL Server Mangement studion icon. You can Run as other windows account user.
One other way that I discovered is to go to "Start" > "Control Panel" > "Stored Usernames and passwords" (Administrative Tools > Credential Manager in Windows 7) and add the domain account that you would use with the "runas" command.
Then, in SQL Management Studio 2005, just select the "Windows Authentication" and input the server you wanna connect to (even though the user that you can see greyed out is still the local user)... and it works!
Don't ask me why ! :)
Edit:
Make sure to include ":1433" after the server name in Credential Manager or it may not connect due to not trusting the domain.
None of these answers did what I needed:
Login to a remote server using a different domain account than I was logged into on my local machine, and it's a client's domain across a vpn. I don't want to be on their domain!
Instead, on the connect to server dialog, select "Windows Authentication", click the Options button, and then on the Additional Connection Parameters tab, enter
user id=domain\user;password=password
SSMS won't remember, but it will connect with that account.
The runas /netonly /user:domain\username program.exe command only worked for me on Windows 10
saving it as a batch file
running it as an administrator,
when running the command batch as regular user I got the wrong password issue mentioned by some users on previous comments.
For Windows 10:
Go to the Sql Management Studio Icon, or Short Cut in the menu:
Right Click > Select Open File Location
Hold Shift and right Click the shortcut, or ssms.exe file that is in the folder. Holding shift will give you an extra option "Run as different user":
This will pop up a login box and you can type the credentials you would like your session to run under.
A bit of powershell magic will do the trick:
cmdkey /add:"SERVER:1433" /user:"DOMAIN\USERNAME" /pass:"PASSWORD"
Then just select windows authentication
There are many places where someone might want to deploy this kind of scenario, but due to the way integrated authentication works, it is not possible.
As gbn mentioned, integrated authentication uses a special token that corresponds to your Windows identity. There are coding practices called "impersonation" (probably used by the Run As... command) that allow you to effectively perform an activity as another Windows user, but there is not really a way to arbitrarily act as a different user (à la Linux) in Windows applications aside from that.
If you really need to administer multiple servers across several domains, you might consider one of the following:
Set up Domain Trust between your domains so that your account can access computers in the trusting domain
Configure a SQL user (using mixed authentication) across all the servers you need to administer so that you can log in that way; obviously, this might introduce some security issues and create a maintenance nightmare if you have to change all the passwords at some point.
Hopefully this helps!
Did anybody tried "plain" runas without parameters? Those /netonly /savcecred all of them sound ambiguous and to me utter nonsense.
C:\Windows\System32\runas.exe /user:DOMAINX\OtherUser02 "C:\Program Files (x86)\Microsoft SQL Server Management Studio 18\Common7\IDE\ssms.exe"
This works just fine. No matter what, runas WILL ask you for the user password. Just type it and be security audit compliant.
The only way to achieve what you want is opening several instances of SSMS by right clicking on shortcut and using the 'Run-as' feature.