• Benefits of new features in MDAC
  • Scenario 1 – ADO application migration from x86 to x64
  • Details of the User Profile WMI Provider
  • Who Should Use User Profile WMI Provider feature enhancements
  • Benefits of new features in User Profile WMI Provider
  • Scenario 1 – List all User Profiles in a remote machine
  • Step-by-step scenario description
  • Scenario 2 – Delete a User Profile
  • Scenario 3 - Change Roaming User Profile preference
  • Scenario 4 - Change User Profile Ownership
  • Additional Information – How to obtain a user’s SID
  • Microsoft Data Access Component (MDAC)




    Download 0,7 Mb.
    bet8/14
    Sana26.12.2019
    Hajmi0,7 Mb.
    #5325
    1   ...   4   5   6   7   8   9   10   11   ...   14

    Microsoft Data Access Component (MDAC)

    What’s New in MDAC


    Support 64 bit OLEDB over ODBC

     MSDASQL.dll is built and deployed on X64 and IA64 systems.

     MSDASQL is installed as the default OLEDB provider for x86.

    Who should use MDAC feature enhancements?


    Customers interested in ADO/OLEDB app migration from x86 to x64 (classic ASP Web apps use ADO extensively).

    Benefits of new features in MDAC


     ADO/OLEDB app migration from x86 to x64 should now be simplified.

     Earlier any connection string that did not explicitly specify an OLEDB provider (e.g. "Provider=SQLOLEDB") would fail to connect after upgrade to x64. The workaround was to have applications update all of their connection strings to use the appropriate OLEDB provider to keep application functionality. Many non-MS data sources do not have matching 64-bit OLEDB providers, so no workaround was possible for these cases (e.g. SyBase).


    Key Scenarios

    Scenario 1 – ADO application migration from x86 to x64


     Validate that 32 bit ADO/OLEDB applications can be successfully migrated/behave correctly on x64 machine with x64 Windows Vista operating system.

    User Profiles

    What’s New in User Profiles

    User Profile WMI Provider


    This User Profile WMI provider replaces Moveuser.exe in Windows Vista. The new User Profile WMI provider can be used to map an existing local account profile to a new domain based account. It can also be used to map an existing domain-based account profile to a new domain-based account profile.

    This WMI Provider has been previously available on the Microsoft Download Center and is now a part of Windows Vista Service Pack 1.

    For more information please refer: http://support.microsoft.com/kb/930955

    Details of the User Profile WMI Provider


    The Win32_UserProfile is added under root\cimv2 namespace in WMI. It provides rich user profile information and methods to manage user profiles.

    Win32_UserProfile

     Properties:

     SID : This property contains the SID of the user who owns this user profile.

     LocalPath: This property contains the user profile's path on the local computer.

     Loaded: This property indicates whether this profile is loaded.

     RefCount: This property indicates the ref count of the profile. If the profile is loaded, the ref count is at least 1. Higher values indicate there more than one application or service has loaded the profile.

     Special: This property indicates whether this profile belongs to a special system service.

     RoamingConfigured: This property indicates whether the user has a roaming profile configured.



    Note

    If a user has a roaming profile configured, it does not mean that this profile is indeed roaming. There are other policies and user preference can prevent the profile from roaming. Please refer to the RoamingPreference and Status property.

     RoamingPath: This property contains the user's roaming profile path if RoamingConfigured is true.

     RoamingPreference: This property indicates whether the user would prefer to have their profile synchronize with the storage location. By default, the RoamingConfigured property is set to true allow the roaming profile to synchronize with the storage location. User can set this property to false to prevent roaming, which will cause the profile work like a local profile.

     Status: May be one or more of the following:

    0x00000001 - Indicates the profile is a temporary profile; it will be deleted at user logoff.

    0x00000002 - Indicates the profile is now set to roaming, if this bit is not set, then it is set to local.

    0x00000004 - Indicates the profile is a mandatory profile.

    0x00000008 - Indicates the profile is a corrupted profile, and not in use, user or administrator must fix the corruption in order to use this profile again.

     LastUseTime: This property indicates when this profile is used last time."

     LastDownloadTime: This property indicates when a roaming profile was downloaded from server last time

     LastUploadTime: This property indicates when a roaming profile was uploaded to server last time.



    Method:

     ChangeOwner: Change a user profile's owner to another user, the result value is HRESULT

    The Win32_UserProfile class is defined in UserProfileWmiProvider.mof and UserProfileWmiProvider.mfl.

    Who Should Use User Profile WMI Provider feature enhancements?


     System Administrators can use this User Profile WMI provider to

     Manage user profiles with a script.

     Query user profiles status and information.

     Change Roaming User Profile preference in some machines .

     Change user profile owner ship (like moveuser.exe in XP).

     Application Developers can use it to build applications for User Profile management.


    Benefits of new features in User Profile WMI Provider


     Query Win32_UserProfile objects to get User Profiles information by WMI

    The Win32_UserProfile properties give very useful information to help IT professionals to remotely troubleshoot profile problems. For example, Administers can find all corrupted user profiles by checking the Status property with a WMI query.

     Delete User Profile by script

    With WMI, administrators can create a script to clean up the unused User Profile remotely.

     Change User Profile ownership

    Administrators can change a user profile ownership from one account to other account with a script. This is very useful when a group of users is moved from one domain to other domain.


    Key Scenarios

    Scenario 1 – List all User Profiles in a remote machine:

    Goal of the scenario:

    Get the User Profiles information from a remote machine.
    Prerequisites or specific configuration for the scenario

     Make sure the WMI in remote machine is enabled

     The firewall for WMI on the remote machine must be open. (For more information, see http://msdn2.microsoft.com/en-us/library/aa822854.aspx.)


    Step-by-step scenario description

    1. Create several (local\domain) test users on the remote machine.

    2. Logon several users on the remote machine, and then log them off.

    3. Run the VB script below with administrator account in an elevated cmd prompt. You will need to specify the full remote machine name (i.e., replace in the script below).

    strComputer = ""

    Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

    Set colProfiles = objWMIService.ExecQuery("Select * from Win32_UserProfile")

    For Each objProfile in colProfiles

    Set objSID = objWMIService.Get("Win32_SID.SID='" & objProfile.SID & "'")

    Wscript.Echo "================================================== " & VBNewLine _

    & "Sid: " & objProfile.Sid & VBNewLine _

    & "User Name: " & objSID.AccountName & VBNewLine _

    & "User Domain: " & objSID.ReferencedDomainName & VBNewLine _

    & "LocalPath: " & objProfile.LocalPath & VBNewLine _

    & "Loaded: " & objProfile.Loaded & VBNewLine _

    & "Special profile: " & objProfile.Special & VBNewLine _

    & "RefCount: " & objProfile.RefCount & VBNewLine _

    & "RoamingConfigured: " & objProfile.RoamingConfigured & VBNewLine _

    & "RoamingPath: " & objProfile.RoamingPath & VBNewLine _

    & "RoamingPreference: " & objProfile.RoamingPreference & VBNewLine _

    & "Status: " & objProfile.Status & " " & StatusString(objProfile.Status) & VBNewLine _

    & "LastUseTime: " & objProfile.LastUseTime & VBNewLine _

    & "LastDownloadTime: " & objProfile.LastDownloadTime & VBNewLine _

    & "LastUploadTime: " & objProfile.LastUploadTime & VBNewLine

    Next


    Function StatusString(status)

    If (status = 0) Then

    StatusString = "Normal"

    End If


    If (status AND 1) Then

    StatusString = "Temporary"

    End If

    If (status AND 2) Then



    StatusString = StatusString & " Roaming"

    End If


    If (status AND 4) Then

    StatusString = StatusString & " Mandatory"

    End If

    If (status AND 8) Then



    StatusString = StatusString & " Corrupted"

    End If


    End Function
    Expected results

    You should see a list of User Profiles in the remote machine.

    Output sample:

    ==================================================

    Sid: S-1-5-21-3804530314-1794463735-1854392452-500

    User Name: Administrator

    User Domain: OWA3-X86

    LocalPath: C:\Users\Administrator

    Loaded: False

    Special profile: False

    RefCount: 0

    RoamingConfigured: False

    RoamingPath:

    RoamingPreference:

    Status: 0 Normal

    LastUseTime: 20070323085130.923000+000

    LastDownloadTime:

    LastUploadTime:

    ==================================================

    Sid: S-1-5-21-3804530314-1794463735-1854392452-1001

    User Name: TestUser1

    User Domain: OWA3-X86

    LocalPath: C:\Users\Jason

    Loaded: False

    Special profile: False

    RefCount: 0

    RoamingConfigured: False

    RoamingPath:

    RoamingPreference:

    Status: 0 Normal

    LastUseTime: 20070323172647.487000+000

    LastDownloadTime:

    LastUploadTime:

    ==================================================

    Sid: S-1-5-21-1774824749-1455565658-4053419961-500

    User Name: Administrator

    User Domain: GTSRUPDC

    LocalPath: C:\Users\administrator.GTSRUPDC

    Loaded: True

    Special profile: False

    RefCount: 1

    RoamingConfigured: False

    RoamingPath:

    RoamingPreference:

    Status: 0 Normal

    LastUseTime: 20070323210540.452000+000

    LastDownloadTime:

    LastUploadTime:

    ==================================================

    Sid: S-1-5-21-1774824749-1455565658-4053419961-3800

    User Name: TestRoamingUser1

    User Domain: GTSRUPDC

    LocalPath: C:\Users\TestRoamingJasO1

    Loaded: False

    Special profile: False

    RefCount: 0

    RoamingConfigured: True

    RoamingPath: \\gtsrup\ariwa\TestRoamingJasO1.V2

    RoamingPreference: True

    Status: 2 Roaming

    LastUseTime: 20070323182735.221000+000

    LastDownloadTime: 20070323182720.971000+000

    LastUploadTime: 20070323182737.471000+000

    ==================================================

    Sid: S-1-5-20

    User Name: NETWORK SERVICE

    User Domain: NT AUTHORITY

    LocalPath: C:\Windows\ServiceProfiles\NetworkService

    Loaded: True

    Special profile: True

    RefCount:

    RoamingConfigured: False

    RoamingPath:

    RoamingPreference:

    Status: 0 Normal

    LastUseTime: 20070323174459.426000+000

    LastDownloadTime:

    LastUploadTime:

    ==================================================

    Sid: S-1-5-19

    User Name: LOCAL SERVICE

    User Domain: NT AUTHORITY

    LocalPath: C:\Windows\ServiceProfiles\LocalService

    Loaded: True

    Special profile: True

    RefCount:

    RoamingConfigured: False

    RoamingPath:

    RoamingPreference:

    Status: 0 Normal

    LastUseTime: 20070323174504.707000+000

    LastDownloadTime:

    LastUploadTime:

    ==================================================

    Sid: S-1-5-18

    User Name: SYSTEM

    User Domain: NT AUTHORITY

    LocalPath: C:\Windows\system32\config\systemprofile

    Loaded: True

    Special profile: True

    RefCount: 1

    RoamingConfigured: False

    RoamingPath:

    RoamingPreference:

    Status: 0 Normal

    LastUseTime: 20070323032214.355000+000

    LastDownloadTime:

    LastUploadTime:


    Scenario 2 – Delete a User Profile:

    Goal of the scenario:

    Clean up the unused User Profiles.
    Prerequisites or specific configuration for the scenario

    Make sure the WMI in the machine is enabled.
    Step-by-step scenario description

    1. Create a test user (named TestUser1).

    2. Logon TestUser1 and then logoff to the machine.

    3. Locate the TestUser1’s User Profile that was created (you can find it under the Users folder, e.g., c:\Users).

    4. Run the following VB script with an administrator account in an elevated command prompt and pass “TestUser1’s SID” to the script as an argument (see the Additional Information section at the end of this section to find out how to obtain the SID of a user) :

    Set objUserProfile = GetObject("winmgmts:{impersonationlevel=impersonate}!\\.\root\cimv2:Win32_UserProfile.SID='" & WScript.Arguments(0) & "'")

    WScript.Echo "Got user profile directory: " & objUserProfile.LocalPath & VBNewLine

    objUserProfile.Delete_

    WScript.Echo "Success!"


    Expected results

    The TestUser1’s profile should be removed. Please run the VB script in scenario 1 to verify. Since this scenario is local, you have to specify the local machine name where it says .

    Output sample:

    Got user profile directory: C:\Users\TestUser1

    Success!

    Scenario 3 - Change Roaming User Profile preference:

    Goal of the scenario:

    Prevent Roaming User Profile to roam on and from a particular machine.
    Prerequisites or specific configuration for the scenario

    Setup a W2K3 domain server and two Windows Vista client machines (called C1 and C2) to join the domain.
    Step-by-step scenario description

    1. Create a domain user (named TestRoamingUser1) with Roaming User Profile enabled.

    2. Logon TestRoamingUser1 to the client machine C1, and then logoff : his profile will get created up on the server.

    3. Run the VB script below with an administrator account in an elevated cmd prompt on the client machine C1. Please pass the two following arguments “TestUser1’s SID” and “False” to the script (see the end of the document to know how to obtain the SID of a user) :

    Set objUserProfile = GetObject("winmgmts:{impersonationlevel=impersonate}!\\.\root\cimv2:Win32_UserProfile.SID='" & WScript.Arguments(0) & "'")

    WScript.Echo "Got user preference: " & objUserProfile.RoamingPreference & VBNewLine

    If (WScript.Arguments(1) = "True") Then

    WScript.Echo "Setting the preference to true" & VBNewLine

    objUserProfile.RoamingPreference = true

    Else

    WScript.Echo "Setting the preference to false" & VBNewLine



    objUserProfile.RoamingPreference = false

    End If


    'Flag 1 means update only

    objUserProfile.Put_(1)WScript.Echo "Success!"

    This script will remove the roaming attribute from TestRoamingUser1 on machine C1

    To verify this change:

    1. Logon TestRoamingUser1 on C2 and create a text file named “Hello.txt” on the TestRoamingUser1’s Desktop.

    2. Logoff TestRoamingUser1 from the client machine C2 (that user’s changes will roam to the server).

    3. Logon TestRoamingUser1 back to the client machine C1.

    Expected results

    You should not see the Hello.txt file on the TestRoamingUser1’s Desktop in the client machine C1, because TestRoamingUser1’s User Profile preference in the client machine C1 is set to false.

    Output sample:

    Got user preference: True

    Setting the preference to false

    Success!

    Scenario 4 - Change User Profile Ownership:

    Goal of the scenario:


    Transfer a User Profile from one user to another user.
    Prerequisites or specific configuration for the scenario

    Make sure the WMI in the machine is enabled.
    Step-by-step scenario description

    1. Create two test users (called TestUser1 and TestUser2) on a local machine.

    2. Logon TestUser1 on the machine.

    3. Create a text file named “Hello.txt” on the TestUser1’s Desktop.

    4. Logoff TestUser1 from the client machine.

    5. Run the following VB script with an administrator account in an elevated command prompt in the client machine C1. Please pass “TestUser1’s SID” and “TestUser2’s SID” and “1 as the Flag parameter” to the script as 3 arguments (see the Additional Information section at the end of this section to find out know how to obtain the SID of a user) :

    Set objUserProfile = GetObject("winmgmts:{impersonationlevel=impersonate}!\\.\root\cimv2:Win32_UserProfile.SID='" & WScript.Arguments(0) & "'")

    WScript.Echo "Change owner for user profile directory: " & objUserProfile.LocalPath & VBNewLine

    returnCode = objUserProfile.ChangeOwner(WScript.Arguments(1), WScript.Arguments(2))

    WScript.Echo "Success!"

    This script will basically make TestUser2 the new owner of TestUser1’s profile.


    To verify this change:

    1. Logon TestUser2: you will see the “Hello.txt” file in TestUser2’s Desktop. This comes from the fact that TestUser1’s user profile has been transferred to TestUser2.

    2. Logoff TestUser2 from the client machine.

    3. Logon as TestUser1 on the client machine: you will see that a new User Profile is created for TestUser1.

    Expected results

    TestUser1’s user profile has been transferred to TestUser2.

    Output sample:

    Change owner for user profile directory: C:\Users\TestUser1

    Success!

    Additional Information – How to obtain a user’s SID

    Here is a script that can be run to obtain a user’s SID:

     Pass as the two following parameters to the script below: “domain name” and “user name”

    Set objAccount = GetObject("winmgmts:{impersonationlevel=impersonate}!\\.\root\cimv2:Win32_UserAccount.Domain='" & WScript.Arguments(0) & "',Name='" & WScript.Arguments(1) & "'")

    WScript.Echo "SID = " & objAccount.SID & VBNewLine

     The return value will be the user’s SID

     If the user is local, specify the “machine name” instead of the “domain name”.



    Download 0,7 Mb.
    1   ...   4   5   6   7   8   9   10   11   ...   14




    Download 0,7 Mb.

    Bosh sahifa
    Aloqalar

        Bosh sahifa



    Microsoft Data Access Component (MDAC)

    Download 0,7 Mb.