invoke-command

Start-job vs. Invoke-command -asjob

I'm trying to do basic background jobs in PowerShell 2.0, and I'm seeing different things with start-job and invoke-command -asjob. If I do this: start-job -scriptblock {get-process} I get a job object, but the child job (which is created automatically by start-job) always has a JobStateInfo of "NotStarted". this, however, works as e...

Run Command as administrator in PowerShell script. UAC

OK here is my issue: I am trying to run a script remotely on a server. I am an administrator on both boxes, firewall exceptions are in place, remote admin is enabled, and everything else looks good that i can see. invoke-command -ComputerName $ComputerName -ScriptBlock ` { cd C:\Windows\System32\inetsrv\; ./appcmd.exe ADD ...

Process list of commands on remote machine with Invoke-Command

Hi there, I'm trying to write a powershell script that will take a list of commands and then run them on a remote machine, I have the following code: foreach($command in $commands) { Invoke-Command -computer "BNEBAK" -scriptblock{"$command"} } Which does not throw any error but also does not actually run the command (e.g stop-servi...

remove-item network location using invoke-command on remote computer fails

Running the following powershell command invoke-computer -computer computer -scriptblock{remove-item -force \\otherpc\backup_dump\TEST\*} I receive the error An object at the specified path \otherpc\backup_dump\TEST\ does not exist. But when I run it locally it works, I suspect there is something to do with scope here but I'...

Can we execute rightclick without using pCmdInfo->lpVerb

I am not agnaist using pCmdInfo->lpVerb but my problem is how will we handle the situation when we create the rightclick submenus dynamically. For example, I have the following scenario: if(strcmp(cRegKeyVal,"Connected")==0) { //g_bConnectStatus=TRUE; InsertMenu ( m_hSubmenu , 0, MF_BYPOSITION|MF_GRAYED, m_uCmdID++,...