Type a page name and press Enter. You'll jump to the page if it exists, or you can create it if it doesn't.
To create a page in a module other than userenv, prefix the name with the module name and a period.
pszProfilePath's capacity must not exceed 260 characters or CreateProfile will return error code 0x800706f7.
Sample Code:
using (System.Security.Principal.WindowsIdentity i = new System.Security.Principal.WindowsIdentity(token))
{
System.Text.StringBuilder s= new System.Text.StringBuilder(260);
uint c= Convert.ToUInt32(s.Capacity);
int hResult = CreateProfile(i.Owner.Value, username, s, c);
}
# Attempts to create a profile for the current logged on user. Obviously, this will not work and it generates a return code
# of -2147024809.
$TypeDefinition=@"
[DllImport("userenv.dll", SetLastError = true, CharSet = CharSet.Auto)]
public static extern int CreateProfile([MarshalAs(UnmanagedType.LPWStr)] String pszUserSid, [MarshalAs(UnmanagedType.LPWStr)] String pszUserName, [Out, MarshalAs(UnmanagedType.LPWStr)] System.Text.StringBuilder pszProfilePath, uint cchProfilePath);
"@
$u=Add-Type -MemberDefinition $TypeDefinition -Name "UserCreateProfile" -Namespace "UserProfile" -UsingNamespace "System.Security.Principal" -PassThru
Create a user profile directory structure in the profile's directory
4/4/2016 6:12:07 PM - -66.192.63.2
Create a user profile directory structure in the profile's directory
4/4/2016 6:12:07 PM - -66.192.63.2
Please edit this page!
Do you have...
helpful tips or sample code to share for using this API in managed code?
corrections to the existing content?
variations of the signature you want to share?
additional languages you want to include?
Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).