One of the nice things about Lync Server PowerShell is that the software is always looking out for you and your best interests. For example, suppose you've created a dial plan named RedmondDialPlan and you've assigned that dial plan to a bunch of users. Later on down the road, you try running this command:

 

Remove-CsDialPlan -Identity "RedmondDialPlan"

 

Now, granted, maybe you fully intended to remove the dial plan RedmondDialPlan. But, then again, maybe you didn't: maybe you were thinking about something else and you inadvertently typed Remove-CsDialPlan instead of Get-CsDialPlan. That could be a problem, seeing as how the plan is currently assigned to a bunch of users. If you accidentally remove RedmondDialPlan, those users might lose their ability to make phone calls, and you might have difficulty restoring that ability. All in all, not exactly the sort of situation you ever want to find yourself in.

 

So is this something that – now that we so helpfully brought it up – is going to keep you up all night, worrying and fretting? Well, it shouldn't. After all, if a per-user dial plan (or any other type of per-user policy) is currently assigned to one or more users, any attempt to remove that dial plan or policy will not result in that item being immediately, and irrevocably, deleted. Instead, you'll see a message similar to this:

 

The policy "RedmondDialPlan" is currently assigned to one or more users. Assign a different policy to users before removing this one.

The policy is in use.

[Y] Yes   [N] No   [S] Suspend     [?] Help (default is "Y"):

 

If you type Y and press ENTER Lync Server will go ahead and delete the dial plan, even though it is currently assigned to one or more users. If you type N and press ENTER the policy will not be deleted, you'll be returned to the Windows PowerShell prompt, and we’ll all get on with our lives as if nothing ever happened. And if you type S and press ENTER … hmmm, that's a good question: what does happen if you type S and then press ENTER?

 

As it turns out, the Suspend option is for those of you who have problems making commitments. You've gotten as far as this confirmation prompt, and now you're having second thoughts: are you sure you want to remove the dial plan RedmondDialPlan? What if you aren't sure? Well, you could simply type N for no. That will save RedmondDialPlan and terminate the Remove-CsDialPlan command. Of course, if you later decide you really do want to delete RedmondDialPlan you'll need to retype your command. But what other choice is there?

 

Actually, there is another choice: you can type S and temporarily postpone your decision making. When you suspend a command, PowerShell essentially bookmarks your place and then lets you move on to other things. If you take a glance at your screen, the Lync Server Management Shell should look something like this:

 

PS C:\> Remove-CsDialPlan -Identity "RedmondDialPlan"

 

The policy "RedmondDialPlan" is currently assigned to one or more users. Assign a different policy to users before removing this one.

The policy is in use.

[Y] Yes   [N] No   [S] Suspend     [?] Help (default is "Y"): s

PS C:\>>>

 

And yes, it looks like PowerShell simply discarded the confirmation prompt. But looks can be deceiving; in reality, PowerShell has grabbed that confirmation prompt and stuck it away in a closet for the time being, thus giving you the chance to do other things while you decide if you really do want to delete the dial plan or not. The fact that your prompt has changed to a "nested" prompt (PS C:\>>>) is a visual cue that you've got unfinished business going on somewhere in this PowerShell session.

 

And what happens when you do make up your mind about RedmondDialPlan? Well, all you have to do at that point is type exit in order to return to your "bookmarked" confirmation prompt:

 

PS C:\>>> exit

 

The policy "RedmondDialPlan" is currently assigned to one or more users. Assign a different policy to users before removing this one.

The policy is in use.

[Y] Yes   [N] No   [S] Suspend     [?] Help (default is "Y"):

 

From there you can either delete the dial plan or keep the dial plan; either way, you'll then return to the usual (i.e., un-nested) PowerShell prompt:

 

PS C:\>>> exit

 

The policy "RedmondDialPlan" is currently assigned to one or more users. Assign a different policy to users before removing this one.

The policy is in use.

[Y] Yes   [N] No   [S] Suspend     [?] Help (default is "Y"): y

 

PS C:\>

 

Incidentally, you can have multiple items suspended at the same time. We had eight different items suspended before we got tired of suspending stuff:

 

·         Remove-CsDialPlan "RedmondDialPlan"

·         Remove-CsClientPolicy "RedmondClientPolicy"

·         Remove-CsConferencingPolicy "RedmondConferencingPolicy"

·         Remove-CsLocationPolicy "RedmondLocationPolicy"

·         Remove-CsExternalAccessPolicy  "RedmondExternalAccessPolicy"

·         Remove-CsConferencingPolicy "RedmondConferencingPolicy"

·         Remove-CsArchivingPolicy "RedmondArchivingPolicy"

·         Remove-CsHostedVoiceMailPolicy "RedmondHostedVoiceMailPolicy"

 

When you do this, each time you type exit PowerShell shows you the last item to be suspended. For example, the last item we suspended was the command to remove a hosted voicemail policy. Consequently, the first prompt we'll see after typing exit is the prompt regarding that policy:

 

PS C:\>>> exit

 

The policy "RedmondHostedVoiceMailPolicy" is currently assigned to one or more users. Assign a different policy to users before removing this one.

The policy is in use.

[Y] Yes   [N] No   [S] Suspend     [?] Help (default is "Y"):

 

After we dispose of that policy, one way or the other, typing exit a second time will show us the prompt for deleting the archiving policy. And so on and so on.

 

If you happen to forget about all your suspended commands and close the Lync Server Management Shell, all those commands will be ignored, so nothing will have been deleted.

 

Note. In case you're wondering, no matter how many items you've got suspended, your prompt will always look like this:

 

PS C:\>>>

 

We were kind of hoping to get a super nested prompt like this one, but no such luck:

PS C:\>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

 

Admittedly, there's at least a 50/50 chance that you'll be able to live a very happy and very productive life without ever using the Suspend option; for example, historians have no record of either Thomas Jefferson or Caesar Augustus ever using the Suspend option. But why take any chances?