Skip to content

Commit

Permalink
Bug fixes (#37)
Browse files Browse the repository at this point in the history
- Bug fixes
- Enhancements
  • Loading branch information
Sarafian authored Dec 14, 2016
1 parent f836dc3 commit 43c4674
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 28 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.Examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
8 changes: 5 additions & 3 deletions Examples/Copy-ISHCD.NotReleased.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -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))
Expand All @@ -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")
Expand All @@ -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
Expand Down
Binary file added Examples/ISHDeploy/Demo-Test for ISHBootstrap.zip
Binary file not shown.
11 changes: 5 additions & 6 deletions Examples/ISHDeploy/Set-ISHCMMenuAndButton.ImplicitRemoting.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ param (
[string]$ISHVersion
)
$ishBootStrapRootPath=Resolve-Path "$PSScriptRoot\..\.."
$ishBootStrapRootPath="C:\GitHub\ISHBootstrap"

$cmdletsPaths="$ishBootStrapRootPath\Source\Cmdlets"
$scriptsPaths="$ishBootStrapRootPath\Source\Scripts"

Expand Down Expand Up @@ -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
{
Expand All @@ -73,4 +72,4 @@ finally
}

Write-Progress @scriptProgress -Completed
Write-Separator -Invocation $MyInvocation -Footer -Name "Configure"
Write-Separator -Invocation $MyInvocation -Footer -Name "Configure"
12 changes: 6 additions & 6 deletions Examples/ISHDeploy/Set-ISHCMMenuAndButton.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ param (
[string]$DeploymentName
)
$ishBootStrapRootPath=Resolve-Path "$PSScriptRoot\..\.."
$ishBootStrapRootPath="C:\GitHub\ISHBootstrap"

$cmdletsPaths="$ishBootStrapRootPath\Source\Cmdlets"
$scriptsPaths="$ishBootStrapRootPath\Source\Scripts"

Expand All @@ -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
{
Expand Down
34 changes: 22 additions & 12 deletions Source/Modules/xISHServer/Grant-ISHUserLogOnAsService.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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){
Expand All @@ -35,22 +46,21 @@ 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"
}



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

}
2 changes: 1 addition & 1 deletion Source/Modules/xISHServer/Initialize-ISHUser.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
4 changes: 4 additions & 0 deletions Tutorials/About CredSSP authentication for PSSession.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```

Expand Down

0 comments on commit 43c4674

Please sign in to comment.