That_annoying_guy

//That_annoying_guy
That_annoying_guy

Forum Replies Created

Viewing 15 posts - 16 through 30 (of 36 total)
  • Author
    Posts
  • That_annoying_guy
    Participant
    Post count: 42

    That great for NEW users on the machines. What about existing users?

    Consider using Set-ActiveSetup

    If all the REG changes go to HKCU you should be able to something like this:

    Set-ActiveSetup -StubExePath “$envWinDir\regedit.exe” -Arguments “/S "%SystemDrive%\Program Files (x86)\PS App Deploy\PSAppDeployHKCUSettings.reg“” -Description ‘PS App Deploy Config’ -Key ‘PS_App_Deploy_Config’ -ContinueOnError $true

  • That_annoying_guy
    Participant
    Post count: 42

    Let’s try that again…

    %env_vars% don’t work like this in Powershell

    Try this (Might not work):

    Execute-Process “c:\Windows\System32\regsvr32.exe” -parameters “$($env:ProgramFiles(x86))\Company Name\Video Gateway\WebViewer.ocx”

    Or This (better, uses PSADT’s variables):

    Execute-Process “c:\Windows\System32\regsvr32.exe” -parameters “$envProgramFilesX86\Company Name\Video Gateway\WebViewer.ocx”

  • That_annoying_guy
    Participant
    Post count: 42

    %env_vars% don’t work like this in Powershell

    Try this (Might not work):

    <pre class=”brush: powershell; gutter: true; first-line: 1; highlight: []; html-script: false”>Execute-Process “c:\Windows\System32\regsvr32.exe” -parameters “$($env:ProgramFiles(x86))\Company Name\Video Gateway\WebViewer.ocx'”

    Or This (better, uses PSADT’s variables):

    <pre class=”brush: powershell; gutter: true; first-line: 1; highlight: []; html-script: false”>Execute-Process “c:\Windows\System32\regsvr32.exe” -parameters “$envProgramFilesX86\Company Name\Video Gateway\WebViewer.ocx'”

  • That_annoying_guy
    Participant
    Post count: 42

    PSADT limits itself to Powershell 2.0 and .Net 2.0

    Neither do zip file handling.

    Consider using 7za.exe from 7-zip

  • That_annoying_guy
    Participant
    Post count: 42
    in reply to: Test-Ping Function #1090

    Ok, PowerShell Pre tags don’t work and the code tags converts code to &useless

    If you want code for Test-IsGroupMember and Convert-ObjectNameToDN you’ll need to tell me where I can post other than WontPress.

    PS: I’ve been asked to create a function for permissions for my local fork (aka your issue #141)
    It would be a wrapper for SetACL.exe (https://helgeklein.com/setacl/) or the COM object.
    Would you be interested?

  • That_annoying_guy
    Participant
    Post count: 42
    in reply to: Test-Ping Function #1087

    <pre class=”brush: powershell; gutter: true; first-line: 1; highlight: []; html-script: false”>

    <code>					Try {
    		            	$GroupList.Add($ADSIObject.sAMAccountName.ToString() + &quot;\&quot; + $Group.Value.Split(&quot;\&quot;)[1], $True)
    					} Catch [System.ArgumentException] { #Item has already been added. Key in dictionary
    						Write-log -Message &quot;$(Resolve-Error)&quot; -Severity 2 -Source ${CmdletName} -DebugMessage
    						Write-log &quot;WARNING: ADSIObject [$($ADSIObject.sAMAccountName.ToString())] has Duplicate membership in group [$($Group.Value)]&quot; -Severity 2 -Source ${CmdletName}
    					} Catch {
    						Write-log -Message &quot;</code>

    $SID [$SID] $(Resolve-Error)” -Severity 2 -Source ${CmdletName}
    }`

  • That_annoying_guy
    Participant
    Post count: 42
    in reply to: Test-Ping Function #1070

    [Deleted!]

  • That_annoying_guy
    Participant
    Post count: 42
    in reply to: Test-Ping Function #1063

    Mo,

    If you are interested, I have the following that I could post once this is:

    Function Test-TCPPort {
    Function Get-Shortcuts {
    Function Add-ToLocalGroup {
    Function Get-LocalUserAccount {
    Function Get-OsNickName {
    Function Get-ComputerOU {
    Function Parse-CMTLogFile {
    Function Get-NicInfo {

  • That_annoying_guy
    Participant
    Post count: 42
    in reply to: Test-Ping Function #1060

    I give up.
    This is gibberish: https://codex.wordpress.org/Writing_Code_in_Your_Posts

    There are no examples on how to post PowerShell code.
    We get no Preview of what it going to look like AND we get 2 tries, that’s it. Post is locked.

    A video would help b/c there are no “Crayons” to play with as mentioned in http://psappdeploytoolkit.com/forums/topic/what-are-toolkit-extensions/

  • That_annoying_guy
    Participant
    Post count: 42

    You can do this but SCCM usually does not like having packages reboot by themselves.
    SCCM sees self-rebooting packages as failed packages.

    If you want to do this, the Execute-MSI function will skip over already installed MSIs by default.

    IOW: You can do what you want but you will have to put all the logic for reboots and such in Deploy-Application.ps1 yourself. It’s not a feature at this time and probably won’t be for a while.

    Good luck!

  • That_annoying_guy
    Participant
    Post count: 42

    Because Move-Item is a powershell NATIVE command, it does what it does.

    you could use write-log to announce that you are about to move a file and that’s about it.

  • That_annoying_guy
    Participant
    Post count: 42

    And now, I can’t edit my post. So let’s try this.

    Since you want Deploy-Application_Prerequisite.ps1 to be hidden, this will work:

    <code>[string]$MyArguments = &quot;-ExecutionPolicy Bypass -NoLogo -File (BackTick)&quot;$dirFiles\Deploy-Application_Prerequisite.ps1(BackTick)&quot; &quot;
    Execute-Process -FilePath &quot;powershell.exe&quot; -Arguments $MyArguments -ContinueOnError $False -CreateNoWindow #No separate window, Only parent. Child is hidden</code>

    Just replace (BackTick) with the ASCII 96

    • This reply was modified 2 years, 7 months ago by  That_annoying_guy.
    • This reply was modified 2 years, 7 months ago by  That_annoying_guy. Reason: Now Square brackets are HTML tags. Oh wonderful!
  • That_annoying_guy
    Participant
    Post count: 42

    Because you have effectively 2 packages, one calling the other, you cannot share PowerShell sessions.(Parent’s Variables would get changed by the child)

    Since you want Deploy-Application_Prerequisite.ps1 to be hidden, this will work:
    [string]$MyArguments = “-ExecutionPolicy Bypass -NoLogo -File“$dirFiles\Deploy-Application_Prerequisite.ps1” ”
    Execute-Process -FilePath “powershell.exe” -Arguments $MyArguments -ContinueOnError $False -CreateNoWindow #No separate window, Only parent. Child is hidden

    If you want to see both as separate consoles:
    [string]$MyArguments = “-ExecutionPolicy Bypass -NoLogo -File"$dirFiles\Deploy-Application_Prerequisite.ps1” ”
    Try {
    $Myprocess = start-process -FilePath “$PSHOME\powershell” -ArgumentList $MyArguments -Wait -PassThru #Works but no exitcode handling
    #CAVEAT: to use redirection, all parameters redirect to a file ONLY! #e.g. -RedirectStandardOutput
    #But we don’t need it b/c Deploy-Application_Prerequisite.ps1 does all this by itself and has it’s own logs.
    $Myprocess.WaitForExit() #wait for it to finish
    $ExitCode=$Myprocess.ExitCode #must be *AFTER* .WaitForExit() method
    If ($Myprocess) { $Myprocess.Dispose() } # Clear memory

    Write-Log -Message “Prerequisite script returned `$ExitCode = $ExitCode”
    If ( 0 -match $ExitCode) {
    Write-Log -Message “Deploy-Application_Prerequisite.ps1 was successful.”
    } ElseIf (-1073741510 -match $ExitCode) {
    Write-Log -Message “ERROR: User closed Prerequisite’s Powershell Console window”
    # CAVEAT Exitcode -1073741510 can become %ErrorLevel% 314 (Quad -> Dword)
    Exit-Script -ExitCode $ExitCode #No prereq, no main package
    } else {
    Write-Log -Message “Deploy-Application_Prerequisite.ps1 Failed.”
    Exit-Script -ExitCode $ExitCode
    }

    } Catch {
    If ([string]::IsNullOrEmpty([string]$returnCode)) {
    [int32]$returnCode = 60002
    Write-Log -Message “start-process failed, setting exit code to [$returnCode]. `n$(Resolve-Error)” -Severity 3 -Source $deployAppScriptFriendlyName
    } Else {
    Write-Log -Message “start-process completed with exit code [$returnCode]. Function failed. `n$(Resolve-Error)” -Severity 3 -Source $deployAppScriptFriendlyName
    }
    Exit-Script -ExitCode $returnCode
    }

    WARNING: WordPress cannot handle Backticks and changes SOME straight double quotes to curly double quotes.

    • This reply was modified 2 years, 7 months ago by  That_annoying_guy. Reason: Wordpress cannot handle backticks
    • This reply was modified 2 years, 7 months ago by  That_annoying_guy. Reason: WordPress cannot handle Backticks and changes SOME straight double quotes to curly double quotes
    • This reply was modified 2 years, 7 months ago by  That_annoying_guy. Reason: Still fighting the back-tick problem
  • That_annoying_guy
    Participant
    Post count: 42

    I’ve never placed with Deploy-Application.exe but doesn’t run as system?
    If so, on the network, System uses your computer account for access control.

    Does your computer account have rights to your DP where your package lives?
    Also, how does your computer account map the drive letter?

  • That_annoying_guy
    Participant
    Post count: 42

    Your Setup.exe should be placed in the \Files folder along with all the other files that Setup.exe requires. Execute-Process will look there first.

    If you want to be explicit, that depends on where you place Setup.exe.
    If it’s the same folder as Deploy-Application.ps1 then it’s $scriptDirectory

Viewing 15 posts - 16 through 30 (of 36 total)