Skip to content

Commit af3234f

Browse files
committed
RemoteApp: fixing confirm message mechanism and updated management package version
1 parent b34552c commit af3234f

File tree

7 files changed

+22
-26
lines changed

7 files changed

+22
-26
lines changed

src/ServiceManagement/RemoteApp/Commands.RemoteApp.Test/Commands.RemoteApp.Test.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@
140140
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.4.1.1\lib\net40\Microsoft.WindowsAzure.Management.dll</HintPath>
141141
</Reference>
142142
<Reference Include="Microsoft.WindowsAzure.Management.RemoteApp">
143-
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.RemoteApp.2.0.1\lib\net40\Microsoft.WindowsAzure.Management.RemoteApp.dll</HintPath>
143+
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.RemoteApp.2.0.2\lib\net40\Microsoft.WindowsAzure.Management.RemoteApp.dll</HintPath>
144144
</Reference>
145145
<Reference Include="Moq, Version=4.2.1402.2112, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
146146
<HintPath>..\..\..\packages\Moq.4.2.1402.2112\lib\net40\Moq.dll</HintPath>

src/ServiceManagement/RemoteApp/Commands.RemoteApp.Test/packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<package id="Microsoft.Rest.ClientRuntime" version="1.2.0" targetFramework="net45" />
1414
<package id="Microsoft.Rest.ClientRuntime.Azure.Authentication" version="0.9.3" targetFramework="net45" />
1515
<package id="Microsoft.WindowsAzure.Management" version="4.1.1" targetFramework="net45" />
16-
<package id="Microsoft.WindowsAzure.Management.RemoteApp" version="2.0.1" targetFramework="net45" />
16+
<package id="Microsoft.WindowsAzure.Management.RemoteApp" version="2.0.2" targetFramework="net45" />
1717
<package id="Moq" version="4.2.1402.2112" targetFramework="net45" />
1818
<package id="Newtonsoft.Json" version="6.0.8" targetFramework="net45" />
1919
<package id="xunit" version="1.9.2" targetFramework="net45" />

src/ServiceManagement/RemoteApp/Commands.RemoteApp/Commands.RemoteApp.Designer.cs

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/ServiceManagement/RemoteApp/Commands.RemoteApp/Commands.RemoteApp.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@
121121
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.Network.7.0.3\lib\net40\Microsoft.WindowsAzure.Management.Network.dll</HintPath>
122122
</Reference>
123123
<Reference Include="Microsoft.WindowsAzure.Management.RemoteApp">
124-
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.RemoteApp.2.0.1\lib\net40\Microsoft.WindowsAzure.Management.RemoteApp.dll</HintPath>
124+
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.RemoteApp.2.0.2\lib\net40\Microsoft.WindowsAzure.Management.RemoteApp.dll</HintPath>
125125
</Reference>
126126
<Reference Include="Microsoft.WindowsAzure.Management.Storage">
127127
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.Storage.5.1.1\lib\net40\Microsoft.WindowsAzure.Management.Storage.dll</HintPath>
@@ -249,4 +249,4 @@
249249
<Target Name="AfterBuild">
250250
</Target>
251251
-->
252-
</Project>
252+
</Project>

src/ServiceManagement/RemoteApp/Commands.RemoteApp/Commands.RemoteApp.resx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,9 +262,9 @@
262262
<value>No VM was found for user {0} in collection {1}.</value>
263263
</data>
264264
<data name="RestartVmWarningCaption" xml:space="preserve">
265-
<value>This operation will logoff all logged-in users on VM</value>
265+
<value>Restart VM {0}</value>
266266
</data>
267267
<data name="RestartVmWarningMessage" xml:space="preserve">
268-
<value>Logged in users on VM: {0}</value>
268+
<value>User {0} is on VM {1}. These users also have active sessions on this VM and will be logged off when the VM is rebooted: {2}</value>
269269
</data>
270270
</root>

src/ServiceManagement/RemoteApp/Commands.RemoteApp/Vm/RestartAzureRemoteAppVm.cs

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
namespace Microsoft.WindowsAzure.Management.RemoteApp.Cmdlets
2222
{
23-
[Cmdlet("Restart", "AzureRemoteAppVM"), OutputType(typeof(TrackingResult))]
23+
[Cmdlet("Restart", "AzureRemoteAppVM", SupportsShouldProcess = true, ConfirmImpact = ConfirmImpact.High), OutputType(typeof(TrackingResult))]
2424
public class RestartAzureRemoteAppVm : RdsCmdlet
2525
{
2626
[Parameter(Mandatory = true,
@@ -52,10 +52,6 @@ public class RestartAzureRemoteAppVm : RdsCmdlet
5252
HelpMessage = "Time to wait before logging off users on the VM (default is 60 seconds)")]
5353
public int LogoffWaitSeconds { get; set; }
5454

55-
[Parameter(Mandatory = false,
56-
HelpMessage = "Do not ask for confirmation if more users are logged into the VM")]
57-
public SwitchParameter DoNotWarn { get; set; }
58-
5955
private RemoteAppVm GetVm(string collectionName, string userUpn)
6056
{
6157
CollectionVmsListResult response = null;
@@ -95,26 +91,26 @@ public override void ExecuteCmdlet()
9591
return;
9692
}
9793

98-
if (!DoNotWarn.IsPresent && vm.LoggedOnUserUpns.Count > 1)
94+
if (vm.LoggedOnUserUpns.Count > 1)
9995
{
100-
string loggedInUsers = null;
96+
string otherLoggedInUsers = null;
97+
string warningCaption = null;
98+
string warningMessage = null;
10199

102100
foreach (string user in vm.LoggedOnUserUpns)
103101
{
104-
if (loggedInUsers == null)
105-
{
106-
loggedInUsers = user;
107-
}
108-
else
102+
if (string.Compare(user, UserUpn, true) != 0)
109103
{
110-
loggedInUsers += ", " + user;
104+
otherLoggedInUsers += "\n" + user;
111105
}
112106
}
113107

114-
if (!ShouldProcess(
115-
string.Format(Commands_RemoteApp.RestartVmWarningMessage, loggedInUsers),
116-
Commands_RemoteApp.GenericAreYouSureQuestion,
117-
Commands_RemoteApp.RestartVmWarningCaption))
108+
warningMessage = string.Format(Commands_RemoteApp.RestartVmWarningMessage, UserUpn, vm.VirtualMachineName, otherLoggedInUsers);
109+
warningCaption = string.Format(Commands_RemoteApp.RestartVmWarningCaption, vm.VirtualMachineName);
110+
111+
WriteWarning(warningMessage);
112+
113+
if (!ShouldProcess(null, Commands_RemoteApp.GenericAreYouSureQuestion, warningCaption))
118114
{
119115
return;
120116
}

src/ServiceManagement/RemoteApp/Commands.RemoteApp/packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<package id="Microsoft.WindowsAzure.Management" version="4.1.1" targetFramework="net45" />
1919
<package id="Microsoft.WindowsAzure.Management.Compute" version="12.3.1" targetFramework="net45" />
2020
<package id="Microsoft.WindowsAzure.Management.Network" version="7.0.3" targetFramework="net45" />
21-
<package id="Microsoft.WindowsAzure.Management.RemoteApp" version="2.0.1" targetFramework="net45" />
21+
<package id="Microsoft.WindowsAzure.Management.RemoteApp" version="2.0.2" targetFramework="net45" />
2222
<package id="Microsoft.WindowsAzure.Management.Storage" version="5.1.1" targetFramework="net45" />
2323
<package id="Newtonsoft.Json" version="6.0.8" targetFramework="net45" />
2424
<package id="System.Spatial" version="5.6.4" targetFramework="net45" />

0 commit comments

Comments
 (0)