Skip to content

Commit 14d599a

Browse files
committed
install skype for business module
1 parent 0dc276d commit 14d599a

File tree

2 files changed

+44
-9
lines changed

2 files changed

+44
-9
lines changed

tools/office-cmdlet-updater/constants/commands.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@ module.exports = {
22
GET_TEAM: 'Get-Team',
33
INSTALL_MICROSOFT_TEAM: 'Install-Module MicrosoftTeams -SkipPublisherCheck',
44
CONNECT_MICROSOFT_TEAM: 'Connect-MicrosoftTeams',
5-
INSTALL_PLATYPS: 'Install-Module -Name platyPS -Scope CurrentUser',
5+
INSTALL_PLATYPS: 'Install-Module -Name platyPS -SkipPublisherCheck -Scope CurrentUser',
66
IMPORT_PLATYPS: 'Import-Module platyPS',
7-
UPDATE_MARKDOWN: 'Update-MarkdownHelp -Path "{}" -LogPath "{}"'
7+
UPDATE_MARKDOWN: 'Update-MarkdownHelp -Path "{}" -LogPath "{}"',
8+
SKYPE_SET_POLICY: 'Set-ExecutionPolicy RemoteSigned ',
9+
SKYPE_INSTALL_MODULE: 'Import-Module "C:\\\\Program Files\\\\Common Files\\\\Skype for Business Online\\\\Modules\\\\SkypeOnlineConnector\\\\SkypeOnlineConnector.psd1" -Force',
10+
SKYPE_GET_CRED: '$cred = Get-Credential',
11+
SKYPE_CREATE_SESSION: '$session = New-CsOnlineSession -Credential $cred -Verbose',
12+
SKYPE_IMPORT_SESSION: 'Import-PSSession -Session $session'
813
};

tools/office-cmdlet-updater/services/power.shell.service.js

Lines changed: 37 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class PowerShellService {
2525

2626
result += output;
2727

28-
[output, err] = await of(this.authIfNeeded());
28+
[output, err] = await of(this.preInstallTeams());
2929

3030
if (err) {
3131
await this.dispose();
@@ -34,17 +34,47 @@ class PowerShellService {
3434

3535
result += output;
3636

37+
[output, err] = await of(this.preInstallSkype());
38+
39+
if (err) {
40+
await this.dispose();
41+
throw new Error(err);
42+
}
43+
44+
result += output;
45+
46+
return result;
47+
}
48+
49+
async preInstallSkype() {
50+
let result;
51+
52+
//result += await this._invokeCommand(commands.SKYPE_SET_POLICY);
53+
54+
result += await this._invokeCommand(commands.SKYPE_INSTALL_MODULE);
55+
56+
result += await this._invokeCommand(commands.SKYPE_GET_CRED);
57+
58+
result += await this._invokeCommand(commands.SKYPE_CREATE_SESSION);
59+
60+
result += await this._invokeCommand(commands.SKYPE_IMPORT_SESSION);
61+
3762
return result;
3863
}
3964

40-
async authIfNeeded() {
65+
async _invokeCommand(command) {
66+
const [output, err] = await of(this.invokeCommand(command));
67+
68+
if (err) {
69+
throw new Error(err);
70+
}
71+
72+
return output;
73+
}
74+
75+
async preInstallTeams() {
4176
let output, err, result;
4277

43-
// const checkAuthCommand = commands.GET_TEAM;
44-
//
45-
// [output, err] = await of(this.invokeCommand(checkAuthCommand));
46-
//
47-
// result += output;
4878
// TODO: check if user already auth
4979

5080
const installModule = commands.INSTALL_MICROSOFT_TEAM;

0 commit comments

Comments
 (0)