วันพฤหัสบดีที่ 31 ตุลาคม พ.ศ. 2562

การลบ Printer

Rem Removes unwanted local print devices from Windows, such as MS OneNote and XPS devices
%WINDIR%\system32\cscript %WINDIR%\System32\Printing_Admin_Scripts\en-US\prnmngr.vbs -xo

Rem Remove unwanted server queues from Windows
%WINDIR%\system32\cscript %WINDIR%\System32\Printing_Admin_Scripts\en-US\prnmngr.vbs -x

Rem Removes printer drivers from devices not in use
%WINDIR%\system32\cscript.exe //NoLogo "%WINDIR%\System32\Printing_Admin_Scripts\en-US\prndrvr.vbs" -x

Rem Adds Network Print Queue
%WINDIR%\system32\cscript.exe %WINDIR%\system32\Printing_Admin_Scripts\en-US\prnmngr.vbs -ac -p \\printservername\queuename

Rem Sets default printer
%WINDIR%\system32\cscript.exe %WINDIR%\system32\Printing_Admin_Scripts\en-US\prnmngr.vbs -t -p \\printservername\queuename



https://theitbros.com/allow-non-admins-install-printer-drivers-via-gpo/

วันพุธที่ 30 ตุลาคม พ.ศ. 2562

วันจันทร์ที่ 21 ตุลาคม พ.ศ. 2562

$Credential = Get-Credential
$ExchangeSession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri "https://outlook.office365.com/powershell-liveid" -Credential $credential -Authentication "Basic" -AllowRedirection
Import-PSSession $ExchangeSession

Get-Mailbox

Get-Mailbox aa@shera.com | FL  Alias,ExchangeGuid

Get-Mailbox -SoftDeletedMailbox | Select-Object Name,ExchangeGuid

New-MailboxRestoreRequest -SourceMailbox <SoftDeletedMailboxGUID> -TargetMailbox <NewTargetMailboxGUID>


Set-MsolUserPrincipalName -UserPrincipalName anne.wallace@contoso.onmicrosoft.com -NewUserPrincipalName anne.jones@contoso.com

#Remove proxy

Get-Mailbox mf13_preparation@shera.com | fl UserPrincipalName,EmailAddresses

Set-Mailbox mf13_preparation@shera.com -EmailAddresses SMTP:mf13_preparation@shera.com

Office 365


#Restored the deleted user using the  -AutoReconcileProxyConflicts parameter
-:Connect

Connect-MsolService


-:To get a list of users in the recycle bin:

Get-MsolUser -ReturnDeletedUsers


-:Restore a deleted user that’s still in the recycle bin:

Restore-MsolUser –UserPrincipalName user@mydomain.com

Restore-MsolUser -UserPrincipalName "user@mydomain.com" -AutoReconcileProxyConflicts

Restore-MsolUser -UserPrincipalName "user00@mydomain.com" -NewUserPrincipalName "user99@shera.com"





#Rename UserPrincipalName

Connect-MsolService
Get-MsolUser -UserPrincipalName mf13_ir@shera.com |select DisplayName,SignInName,UserPrincipalName

Set-msoluserprincipalname -userprincipalname pawinee_p@shera.com -newuserprincipalname pawinee_p2@shera.com




#Removed the ImmutableID

Set-MSOLUser -UserPrincipalName user@domain.com -ImmutableID "$null"


#Add new the ImmutableID

$userUPN = "user@domain.com"
$guid = [guid]((Get-ADUser -LdapFilter "(userPrincipalName=$userUPN)").objectGuid)
$immutableId = [System.Convert]::ToBase64String($guid.ToByteArray())
$immutableId

Set-MsolUser -UserPrincipalName user@domain.com -ImmutableId 
$immutableId