diff --git a/CHANGELOG.Examples.md b/CHANGELOG.Examples.md index c6e0437..e2e3c10 100644 --- a/CHANGELOG.Examples.md +++ b/CHANGELOG.Examples.md @@ -9,6 +9,7 @@ - When executing script `Initialize-ISHServer.ps1` locally, all **xISHServer.\*** loaded instances are removed and the correct **xISHServer.Y** is automatically imported. - Enhanced progress indicators in scripts. - Changes in the JSON structure regarding WinRM secure. +- Enhanced script `Set-ISHCMMenuAndButton.ps1` and `Set-ISHCMMenuAndButton.ImplicitRemoting.ps1` to align with the recent changes of ISHDeploy modules. ## pre-release v0.3 diff --git a/Examples/Copy-ISHCD.NotReleased.ps1 b/Examples/Copy-ISHCD.NotReleased.ps1 index 9f416e6..ea2d61f 100644 --- a/Examples/Copy-ISHCD.NotReleased.ps1 +++ b/Examples/Copy-ISHCD.NotReleased.ps1 @@ -26,7 +26,6 @@ $scriptsPaths="$sourcePath\Scripts" $computerName=Get-ISHBootstrapperContextValue -ValuePath "ComputerName" -DefaultValue $null $credential=Get-ISHBootstrapperContextValue -ValuePath "CredentialExpression" -Invoke $ishVersion=Get-ISHBootstrapperContextValue -ValuePath "ISHVersion" -$ishServerVersion=($ishVersion -split "\.")[0] . "$cmdletsPaths\Helpers\Invoke-CommandWrap.ps1" @@ -37,11 +36,11 @@ $copyBlock= { Write-Debug "targetPath=$targetPath" $cdObject=((Get-ChildItem $internalCDFolder |Where-Object{Test-Path $_.FullName -PathType Leaf}| Sort-Object FullName -Descending)[0]) - Write-Debug "cdObject=$($cdObject.FullName)" + Write-Verbose "Found latest release $($cdObject.FullName)" Copy-Item $cdObject.FullName $env:TEMP $cdPath=Join-Path $env:TEMP $cdObject.Name - Write-Debug "Copied file $($cdObject.FullName) to $cdPath" + Write-Verbose "Copied file $($cdObject.FullName) to $cdPath" Write-Debug "targetPath=$targetPath" if(-not (Test-Path $targetPath)) @@ -51,6 +50,8 @@ $copyBlock= { Remove-Item "$targetPath\*" -Force -Recurse Write-Verbose "$targetPath is ready" + $ishServerVersion=($ishVersion -split "\.")[0] + Write-Debug "ishServerVersion=$ishServerVersion" if($ISHServerVersion -eq "12") { $arguments=@("-d$targetPath","-s") @@ -63,6 +64,7 @@ $copyBlock= { "-InstallPath=`"$($targetPath.Replace('\','\\'))`"" ) } + Write-Debug "arguments=$($arguments -join " ")" Write-Debug "Unzipping $cdPath in $targetPath" Start-Process $cdPath -ArgumentList $arguments -Wait diff --git a/Examples/ISHDeploy/Demo-Test for ISHBootstrap.zip b/Examples/ISHDeploy/Demo-Test for ISHBootstrap.zip new file mode 100644 index 0000000..aae9891 Binary files /dev/null and b/Examples/ISHDeploy/Demo-Test for ISHBootstrap.zip differ diff --git a/Examples/ISHDeploy/Set-ISHCMMenuAndButton.ImplicitRemoting.ps1 b/Examples/ISHDeploy/Set-ISHCMMenuAndButton.ImplicitRemoting.ps1 index 5a599df..a52dbeb 100644 --- a/Examples/ISHDeploy/Set-ISHCMMenuAndButton.ImplicitRemoting.ps1 +++ b/Examples/ISHDeploy/Set-ISHCMMenuAndButton.ImplicitRemoting.ps1 @@ -25,6 +25,8 @@ param ( [string]$ISHVersion ) $ishBootStrapRootPath=Resolve-Path "$PSScriptRoot\..\.." +$ishBootStrapRootPath="C:\GitHub\ISHBootstrap" + $cmdletsPaths="$ishBootStrapRootPath\Source\Cmdlets" $scriptsPaths="$ishBootStrapRootPath\Source\Scripts" @@ -52,17 +54,14 @@ try $remote=Add-ModuleFromRemote -ComputerName $Computer -Credential $Credential -Name $ishDelpoyModuleName } - # Create a new tab for CUSTOM event types $hash=@{ Label="Custom Event" Description="Show all custom events" EventTypesFilter=@("CUSTOM1","CUSTOM2") UserRole=@("Administrator","Author") } - Set-ISHUIEventMonitorTab -ISHDeployment $DeploymentName @hash - Move-ISHUIEventMonitorTab -ISHDeployment $DeploymentName -Label $hash["Label"] -First - Write-Host "Event monitor tab created" - + Set-ISHUIEventMonitorMenuBarItem -ISHDeployment $DeploymentName @hash + Move-ISHUIEventMonitorMenuBarItem -ISHDeployment $DeploymentName -Label $hash["Label"] -First } finally { @@ -73,4 +72,4 @@ finally } Write-Progress @scriptProgress -Completed -Write-Separator -Invocation $MyInvocation -Footer -Name "Configure" +Write-Separator -Invocation $MyInvocation -Footer -Name "Configure" \ No newline at end of file diff --git a/Examples/ISHDeploy/Set-ISHCMMenuAndButton.ps1 b/Examples/ISHDeploy/Set-ISHCMMenuAndButton.ps1 index 4ddc7f4..e082d08 100644 --- a/Examples/ISHDeploy/Set-ISHCMMenuAndButton.ps1 +++ b/Examples/ISHDeploy/Set-ISHCMMenuAndButton.ps1 @@ -23,6 +23,8 @@ param ( [string]$DeploymentName ) $ishBootStrapRootPath=Resolve-Path "$PSScriptRoot\..\.." +$ishBootStrapRootPath="C:\GitHub\ISHBootstrap" + $cmdletsPaths="$ishBootStrapRootPath\Source\Cmdlets" $scriptsPaths="$ishBootStrapRootPath\Source\Scripts" @@ -43,25 +45,23 @@ if(-not (Get-Command Invoke-CommandWrap -ErrorAction SilentlyContinue)) } $setUIFeaturesScirptBlock= { - # Create a new tab for CUSTOM event types $hash=@{ Label="Custom Event" Description="Show all custom events" EventTypesFilter=@("CUSTOM1","CUSTOM2") UserRole=@("Administrator","Author") } - Set-ISHUIEventMonitorTab -ISHDeployment $DeploymentName @hash - Move-ISHUIEventMonitorTab -ISHDeployment $DeploymentName -Label $hash["Label"] -First - Write-Host "Event monitor tab created" + Set-ISHUIEventMonitorMenuBarItem -ISHDeployment $DeploymentName @hash + Move-ISHUIEventMonitorMenuBarItem -ISHDeployment $DeploymentName -Label $hash["Label"] -First } #Install the packages try { - $blockName="Set UI Features on $DeploymentName" + $blockName="Setting UI Features on $DeploymentName" Write-Progress @scriptProgress -Status $blockName - Invoke-CommandWrap -ComputerName $Computer -Credential $Credential -ScriptBlock $setUIFeaturesScirptBlock -BlockName $blockName -UseParameters @("DeploymentName") + Invoke-CommandWrap -ComputerName $Computer -Credential $Credential -ScriptBlock $setUIFeaturesScirptBlock -BlockName "Set UI Features on $DeploymentName" -UseParameters @("DeploymentName") } finally { diff --git a/Source/Modules/xISHServer/Grant-ISHUserLogOnAsService.ps1 b/Source/Modules/xISHServer/Grant-ISHUserLogOnAsService.ps1 index 67868e0..6b3bfbe 100644 --- a/Source/Modules/xISHServer/Grant-ISHUserLogOnAsService.ps1 +++ b/Source/Modules/xISHServer/Grant-ISHUserLogOnAsService.ps1 @@ -18,11 +18,22 @@ function Grant-ISHUserLogOnAsService{ param( [string[]] $User ) - - + $tempExportInfPath=Join-Path $env:TEMP tempexport.inf + $tempSECEditPath=Join-Path $env:TEMP secedit.sdb + $tempExportInfPath=Join-Path $env:TEMP tempexport.inf + if(Test-Path $tempExportInfPath) + { + Write-Warning "Removing $tempExportInfPath" + Remove-Item -Path $tempExportInfPath -Force + } + if(Test-Path $tempSECEditPath) + { + Write-Warning "Removing $tempSECEditPath" + Remove-Item -Path $tempSECEditPath -Force + } #Get list of currently used SIDs - secedit /export /cfg tempexport.inf - $curSIDs = Select-String .\tempexport.inf -Pattern "SeServiceLogonRight" + & secedit /export /cfg $tempExportInfPath + $curSIDs = Select-String $tempExportInfPath -Pattern "SeServiceLogonRight" $Sids = $curSIDs.line $sidstring = "" foreach($user in $User){ @@ -35,13 +46,13 @@ param( if($sidstring){ $newSids = $sids + $sidstring Write-Host "New Sids: $newSids" - $tempinf = Get-Content tempexport.inf + $tempinf = Get-Content $tempExportInfPath $tempinf = $tempinf.Replace($Sids,$newSids) - Add-Content -Path tempimport.inf -Value $tempinf - secedit /import /db secedit.sdb /cfg ".\tempimport.inf" - secedit /configure /db secedit.sdb + Add-Content -Path $tempExportInfPath -Value $tempinf + & secedit /import /db secedit.sdb /cfg $tempExportInfPath + & secedit /configure /db secedit.sdb - gpupdate /force + & gpupdate /force } else{ Write-Host "No new sids" @@ -49,8 +60,7 @@ param( - Remove-Item ".\tempimport.inf" -force -ErrorAction SilentlyContinue - Remove-Item ".\secedit.sdb" -force -ErrorAction SilentlyContinue - Remove-Item ".\tempexport.inf" -force + Remove-Item $tempSECEditPath -force -ErrorAction SilentlyContinue + Remove-Item $tempExportInfPath -force -ErrorAction SilentlyContinue } diff --git a/Source/Modules/xISHServer/Initialize-ISHUser.ps1 b/Source/Modules/xISHServer/Initialize-ISHUser.ps1 index 9915fc5..eb24f4b 100644 --- a/Source/Modules/xISHServer/Initialize-ISHUser.ps1 +++ b/Source/Modules/xISHServer/Initialize-ISHUser.ps1 @@ -28,7 +28,7 @@ function Initialize-ISHUser if(Get-Module "Microsoft.PowerShell.LocalAccounts" -ListAvailable) { # https://technet.microsoft.com/en-us/library/mt651690.aspx - if(-not (Get-LocalGroupMember -Name Administrators -Member $OSUser)) + if(-not (Get-LocalGroupMember -Name Administrators -Member $OSUser -ErrorAction SilentlyContinue)) { Add-LocalGroupMember -Group "Administrators" -Member $OSUser } diff --git a/Tutorials/About CredSSP authentication for PSSession.md b/Tutorials/About CredSSP authentication for PSSession.md index 2b4033c..fbdf38d 100644 --- a/Tutorials/About CredSSP authentication for PSSession.md +++ b/Tutorials/About CredSSP authentication for PSSession.md @@ -30,6 +30,10 @@ You will get this error To enable the feature either follow the steps described in the error or execute this ```powershell +$service=Get-Service -Name WinRm +$service.StartType="Automatic" +$service|Set-Service +Start-Service -Name WinRm Enable-WSManCredSSP -Role client -DelegateComputer *.domain.com ```