How to Delete WSD printer Port

I had a Windows 2012 R2 printserver where a WSD port was still there after printer deletion. Delete only the port was not possible (operation not permit).

The spooler will delete the port only if it is assigned to a printer and you are deleting the printer. As workaround you can create a fake printer using this port and a preinstalled driver, then delete the printer.

But using powershell is possible to work less…

List all the WSD Printer Port:

Get-PrinterPort -Name wsd*

Delete the WSD Printer Port (PortName):

Remove-PrinterPort -Name PortName

or if you have only one WSD port:

Remove-PrinterPort -Name (Get-PrinterPort -Name wsd*).name

How to Create a Link to a SharePoint Library opening with Explorer

Open your SharePoint library with IE (otherwise the button “Open with Explorer” is disabled) and open it with Explorer using the button on Ribbon:

Sharepoint_OpenWithExplorer

Within Windows Explorer, right-click on a folder of your Library and select “Create Shortcut”.

Right click on the new shortcut and select “properties”.

Copy the URL you find on “Target”; Should be something like this:

\\your.sharepoint.com@SSL\DavWWWRoot\sites\LIBRARY

Explorer_SharepointLink

Now on a SharePoint page or in any HTML page, create a link with this URL:

file:////your.sharepoint.com@SSL/DavWWWRoot/sites/LIBRARY

Example:

<a href="file://your.sharepoint.com@ssl/DavWWWRoot/sites/LIBRARY/FOLDER">My Library Shortcut</a>

Notes:
In case your URL contains any spaces you need to encode them as “%20”. For other encodings see: http://www.w3schools.com/tags/ref_urlencode.asp

ERROR: dcdiag warning on userAccountControl

On a new build-up DC, running dcdiag I found this problem:

Starting test: MachineAccount
Warning:  Attribute userAccountControl of myDC is:
0x82020 = ( PASSWD_NOTREQD | SERVER_TRUST_ACCOUNT | TRUSTED_FOR_DELEGAT ION )
Typical setting for a DC is
0x82000 = ( SERVER_TRUST_ACCOUNT | TRUSTED_FOR_DELEGATION )
This may be affecting replication?

Using ADUC with “Advanced Features” enabled, on “Attributes Editor” you can change userAccountControl for your DC’s Computer Object

UserAccountControl values:
Typical user : 0x200 (512)
Domain controller : 0x82000 (532480)
Workstation/server: 0x1000 (4096)

Via: https://support.microsoft.com/en-us/help/305144/how-to-use-the-useraccountcontrol-flags-to-manipulate-user-account-properties

How to connect Remotely to SQL Express using SSMS

If you have SQL Sever Browser stopped (as generally is using SQL Express), to connect remotely using “Microsoft SQL Server Management Studio” you should specify the port on server/instance string.

First check if SQL Server Browser is stopped with “SQL Server Configuration Manager”

SQL_ServiceConf

Then check the TCP Port of your SQL Express Instance (in this case is a Dynamic Port):

SQL_TCP_DynamicPort

Then you can connect to your SQL Express instance specifying as “Server Name” this string (pay attention to the comma after SQL instance name):

SQLServer\Instance,TCPPort

 

SSMS_sqlexpress_Login

How to Find which DC is pruning your printer queues

When you publishing printer queues on Active Directory, by default the printer spooler save the shared printers info as object inside the printserver computer object.

On DC (generally the site DC of the printserver) by default is running a printers pruning; this job check if the printserver is reachable and if the printer is still shared and if not, delete the printQueue object from AD.

  • Printserver publish by default the printers only at startup (if you what to force the printer publishing just restart the printspooler service)
    This Setting is managed by “Computer Configuration / Administrative Templates / Printers / Check Published State”
  • Dc try to contact the prinserver/printer for 3 time every 8 hours. If for 3 time the prinserver/printer is not reachable then will be unpublished.
    This Setting is managed by “Computer Configuration / Administrative Templates / Printers / Allow Pruning of Published Printers”, “Directory Pruning Interval”, “Directory Pruning Retry”
“The Print Pruner is a thread that runs under the spooler context on all DCs. It
uses ADSI calls ( ADsGetObject, IID_IDirectorySearch->ExecuteSearch) to get the
list of all the printQueue servers in the AD.
To check whether the server is in same site it uses Winsock call (gethostbyname)
and other net APIs (DsAddressToSiteNames,DsGetDcSiteCoverage).
To check if the print queue\print server availability it uses OS APIs
(NetServerGetInfo, OpenPrinter,GetPrinter).
So all the work by pruner is done using ADSI, WinSock and OS functions.”

 

Can happen that for some firewall/network misconfiguration, a DC start to pruning some/every published print queues on regular basis. To find which DC is making too much cleaning, we first try to find the deleted printQueue object:

Find deleted Object

  1. Run ldp.exe as Domain Admin.
  2. On “Connection” menu click “Connect”. You can leave the server name black to connect to the DC on your site.
  3. On “Connection” menu click “Bind”
  4. On “Browse” menu click “Search”. Select the “Base DN” of the domain where you want to retrive tombstones. In “Filter” box use filter “(objectclass=printQueue)”. Under “Scope” select “Subtree”. Click “Options” and under “Search Call Type” select “Extended”. Then add “1.2.840.113556.1.4.417” on “Active Controls” using “Check in”.
    ldp_DeletedObject_PrintQueue_Conf
  5. Close “Search Options” and on “Search” dialog box, click “Run”
  6. On results, find your deleted printer and copy the CN of the deleted printQueue:

ldp_DeletedObject_PrintQueue

 

Find origin of change

Then using repadmin you can find from where this object was updated:

repadmin /showobjmeta [myDC] [CN of object]

repadmin_DeletedObject_PrintQueue

 

Via: https://blogs.technet.microsoft.com/askpfeplat/2012/03/05/how-to-track-the-who-what-when-and-where-of-active-directory-attribute-changes-part-i-the-case-of-the-mysteriously-modified-upn/

https://blogs.technet.microsoft.com/askpfeplat/2012/03/05/how-to-track-the-who-what-when-and-where-of-active-directory-attribute-changes-part-i-the-case-of-the-mysteriously-modified-upn/