Compartir a través de


Encrypt method of the Win32_OfflineFilesCache class

Encrypts or unencrypts the contents of the Offline Files cache that are cached for the calling user. When the cache is encrypted, all files subsequently cached are automatically encrypted. When the cache is unencrypted, all files that are subsequently cached are cached unencrypted.

Syntax

uint32 Encrypt(
  [in] boolean Encrypt,
  [in] uint32  Flags
);

Parameters

Encrypt [in]

TRUE to encrypt, FALSE to unencrypt.

Flags [in]

This parameter can be one or more of the following values.

OfflineFilesEncryptionControlFlagLowPriority (0x00000200)

Reserved for future use.

OfflineFilesEncryptionControlFlagAsyncProgress (0x00000400)

Progress is reported to the progress interface asynchronously with the actual operations. If this flag is not set, progress is reported synchronously with each operation.

OfflineFilesEncryptionControlFlagInteractive (0x00000800)

Set this flag if the operation is allowed to display user interface elements as necessary. An example is the system's credential-request dialog.

OfflineFilesEncryptionControlFlagConsole (0x00001000)

This flag is ignored if the OfflineFilesEncryptionControlFlagInteractive flag is not set. If the OfflineFilesEncryptionControlFlagInteractive flag is set, this flag indicates that any UI produced should be directed to the console window associated with the process invoking the operation.

OfflineFilesEncryptionControlFlagBackground (0x00010000)

Set this flag if you want the encryption operation to avoid sharing violations in the event that an application opens a file that is currently open for the encryption operation. When that scenario occurs and this flag is set, the encryption operation immediately stops processing that particular file at that time. This flag is primarily used by the Offline Files service when ensuring cache encryption at user logon. Normally, a client calling this method would not set this flag.

Return value

This method returns either a WMI return code or a system error code.

Remarks

The cancellation of this operation does not restore the cached files to their prior encryption state. This may leave the cache in a partially encrypted or unencrypted state. The same condition can occur if the operation is aborted due to an error. To resolve the partial state, repeat the operation until successful completion.

Also note that the Offline Files service automatically performs the encryption operation in the background following user logon. This ensures that all files cached by that user are in the correct state encrypted or unencrypted to match the state of the cache.

If canceled while... Cache state is... New cached files will be...
Encrypting Partially encrypted Encrypted
Unencrypting Partially unencrypted Unencrypted

Requirements

Minimum supported client
Windows Vista
Minimum supported server
Windows Server 2008
Namespace
Root\CIMv2
MOF
OfflineFilesWmiProvider.mof
DLL
CscObj.dll

See also

Win32_OfflineFilesCache