How to run deployment groups on a virtual machine? - azure-devops

I want to run a deployment groups on my virtual machine.
I have run my registration script (PowerShell), but it shows the error:
Exception calling "DownloadFile" with "2" argument(s): "The remote name could not be resolved:
'vstsagentpackage.azureedge.net'"
At line:1 char:1303
+ ... nalString, $True);}; $WebClient.DownloadFile($Uri, $agentZip);Add-Typ ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : WebException
I found in Microsoft document that I need to pass --proxyurl, --proxyusername and --proxypassword in the script.
./config.cmd --proxyurl http://127.0.0.1:8888 --proxyusername "myuser" --proxypassword "mypass"
But I don't know what value to fill in, especially the URL.
I tried to copy this script and put it in my registration script, but the same error still occurs.
Any help would be appreciated.

I think if you are using this on your office network or wherever the internet connection requires proxy, and that may have proxy settings, then you can get the proxy url from the Internet proxy settings. Creds has to be supplied if it uses a proxy username/pwd.
The below info may not be ideal for everyone, so don't blame me for this solution but this is what worked for me and for my need.
Note: THIS HAS TO HAVE ATTENTION AND UTMOST CARE IF YOU'RE RUNNING ON A SERVER
you may copy the ps scripts to a notepad,
do the steps manually on the designated server.
Download the agent zip file from web
extract it
copy the contents to the A# folder that you want to setup, mostly A1
run the config.cmd line from the ps script which would expect the appropriate creds that you need to make sure to supply as token
If you have appropriate permissions, it will go forward and install the agent on the respective server and prompt you for further steps like tags etc.
UPDATE:
I didn't have enough permissions to create the Deployment group but rather, just a deployment item (VM)
So I created the Deployment group manually from the deployment target. I had issues when creating it but going backwards by creating a group from the target was successful for me.

Related

How can I access to my own localhost with port number in powershell?

I am writing a script in PowerShell that will automate some actions within an application which is running on my localhost port 81. I need to access this application's content via PowerShell so I can edit and save it.
I learnt a lot about PSSession, but the app I'm trying to reach is on my own machine, not remote. Is there a way to do this?
Edit:
The application I'm trying to reach is TeamCity. I set its port to 81 and to access the application I just need to type http://localhost:81 in my web browser to open TeamCity's UI.
I learnt the process of creating a new project and its builds through the application itself, but by doing so some files are created somewhere and that's what I'm trying to do programmatically:
nsn -ComputerName localhost -port 81 -Credential Get-Credential
I get this error :
nsn : [localhost] Connecting to remote server localhost failed with
the following error message: The WinRM client cannot process the
request. It cannot determine the content type of the HTTP response
from the destination computer. The content type is absent or invalid.
For more information, see the about_Remote_Troubleshooting Help
topic.At line:1 char: 1
+ nsn -ComputerName localhost -Port 81 -Credential Get-Credential
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OpenError: (System.Manageme....RemoteRunspace:RemoteRunspace) [New-PSSession],
PSRemotingTransportE xception
+ FullyQualifiedErrorId : -2144108297,PSSessionOpenFailed
I also tried in vain set-location http://localhost:81 but got the error saying the path is not a drive (knew it already).
even though the context of what you're trying to do is lacking, you should be able to just use "http://localhost:81" as your url vs an actual web address. PSSession's wouldn't apply here, since you're (likely) not remoting (completely unable to tell though due to lack of details)
edit: thanks for updating your answer. I haven't used TeamCity before, but I'm pretty familiar with Git and TFS, and neither of those would have you connect over WinRM. Also, you wouldn't be able to connect over WinRM to your localhost, as that negates the purpose of Windows Remote Management. If you know what commands you are trying to run after entering the New-PSSession (nsn), just run those and skip starting the PSSession.
I am pretty sure the only commands you'd need to do with TeamCity are git or git-like, which would be outside of Powershell. Otherwise, you'd be going through some sort of API call over http/https and not through WinRM. If you're trying to manage the server that TeamCity is on, that's a different story that brings me back to my point about not needing WinRM because you don't need to remotely manage a server that you're already on, you just manage it directly.

Can I remove Windows App Store from Windows 8.1?

I was given the task of removing bloatware from a brand-new Acer laptop. My (and the laptop owner's) definition of bloatware includes all pre-installed Apps and the Winstore itself. You may disagree with that, but that's beside the point.
I tried the remove-appxpackage Powershell command with Winstore's ID and got an error, the important part of which is
This app is part of Windows and cannot be uninstalled on a per-user basis. An
administrator can attempt to remove the app from the computer using Turn Windows Features on or off. However, it may not be possible to uninstall the app.
I didn't see any such option in the Windows Features menu. Can the Winstore be removed from Win8.1?
Here's the full error message (for reference):
remove-appxpackage : Deployment failed with HRESULT: 0x80073CFA, Removal failed. Please contact your software vendor.
(Exception from HRESULT: 0x80073CFA)
error 0x80070032: AppX Deployment Remove operation on package winstore_1.0.0.0_neutral_neutral_cw5n1h2txyewy from:
C:\Windows\WinStore failed. This app is part of Windows and cannot be uninstalled on a per-user basis. An
administrator can attempt to remove the app from the computer using Turn Windows Features on or off. However, it may
not be possible to uninstall the app.
NOTE: For additional information, look for [ActivityId] 83cee5eb-80ef-0001-3bc1-cf83ef80d001 in the Event Log or use
the command line Get-AppxLog -ActivityID 83cee5eb-80ef-0001-3bc1-cf83ef80d001
At line:1 char:1
+ remove-appxpackage winstore_1.0.0.0_neutral_neutral_cw5n1h2txyewy -confirm
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : WriteError: (winstore_1.0.0....l_cw5n1h2txyewy:String) [Remove-AppxPackage], IOException
+ FullyQualifiedErrorId : DeploymentError,Microsoft.Windows.Appx.PackageManager.Commands.RemoveAppxPackageCommand
I am sure you figured this out by now, but seeing as you haven't given this question an check mark for correct answer I am giving you my two cents.
First stop the service named:
Go to Services
Find the service called: Display Name: Windows Store Service(WSService)
Run "remove-appxpackage Winstore's ID"
This should remove the application, but only once the service is stopped. If you cannot find the service in Services, go find it in the registry. The registry name is: Service Name (registry): WSService
Let me know if this helps you a year and a half later. For future reference all applications running a services most likely need that service stopped before a remove is possible.
The UnderDog
You should be able to remove the Winstore in the context of the machine, rather than the user (which is implied by the error message). I have met with success removing Group Policy (which also insists that it is a part of Windows) by using a Task Scheduler task (running as LOCALSYSTEM) to stop the service and then remove it.
Since the Winstore is a Windows Service, this solution should work for you.

Azure Powershell Port

We have a VM that has restrictive internet access to the datacenter we host all our Azure Resources on (Say West US for Example) which is trying to run a command (automation) using powershell
The IPs opened were from the Microsoft reference for our particular Datacenter http://www.microsoft.com/en-us/download/details.aspx?id=41653
Because of the restrictive access,I was able to install the Powershell commandlets 0.8.8 from Github https://github.com/Azure/azure-sdk-tools/releases
Whenever I try to run a specific PoSH command it fails
PS C:\Users\ncsa> Get-AzureSubscription | Select-AzureSubscription
Id : Masked
Name : RBXEnv
Environment : AzureCloud
Account : Masked
Properties : {}
PS C:\Users\nsalgar> Get-AzureSqlDatabaseServer
WARNING: Client Session Id: 'b75d4a4a-0964-40d0-b696-4c94992c22e6-2014-09-18 20:53:05Z'
WARNING: Client Request Id: '0305e7d5-7e50-4089-a2f2-3390130cf8b6-2014-09-18 21:01:42Z'
Get-AzureSqlDatabaseServer : **An error occurred while sending the request.**
At line:1 char:1
+ Get-AzureSqlDatabaseServer
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-AzureSqlDatabaseServer], HttpRequestException
+ FullyQualifiedErrorId : Microsoft.WindowsAzure.Commands.SqlDatabase.Server.Cmdlet.GetAzureSqlDatabaseServer
When I run the same from my desktop it works just fine coz there are no Internet restrictions
Can some one tell me IP Range / Ports the Windows Azure Powershell uses
You need to ensure that you have set the Azure SQL Database to allow connections from other Azure resources (it's an option on the firewall settings page for Azure SQL Database).
You might want to validate port 1433 is open outbound. My organization was blocking outbound 1433 since 2005 when the slammer worm was going around. There are a couple ways to test. The easiest is to telnet <dbservername> 1433 if you get a blank cmd window you are in. You can also download NMap to do a quick port scan.

Test WSMan in powershell

I am trying to take backup of my server from client machine using powershell.
i am trying to execute a batch file which is on my server, but i am not able to make connection with my server. I searched a lot and tried
Test-WSMan : The WinRM client cannot process the request. If the authentication scheme is different from Kerberos, or i
f the client computer is not joined to a domain, then HTTPS transport must be used or the destination machine must be a
dded to the TrustedHosts configuration setting. Use winrm.cmd to configure TrustedHosts. Note that computers in the Tru
stedHosts list might not be authenticated. You can get more information about that by running the following command: wi
nrm help config.
At line:1 char:11
+ Test-WsMan <<<< 182.50.121.100 -credential $cred -authentication default
+ CategoryInfo : InvalidOperation: (182.50.121.100:String) [Test-WSMan], InvalidOperationException
+ FullyQualifiedErrorId : WsManError,Microsoft.WSMan.Management.TestWSManCommand
can any one tell me how can i execute the bat file step by step
Have you added your host name or IP in "GPEDIT" i.e.Group Policy and enabled to use fresh credentials?
Please follow the step if you might have missed something.
(http://www.ifunky.net/Blog/post/How-To-Enable-PowerShell-Remoting-(WinRM).aspx ,
http://blog.crayon.no/blogs/janegil/archive/2010/03/04/enable_2D00_and_2D00_configure_2D00_windows_2D00_powershell_2D00_remoting_2D00_using_2D00_group_2D00_policy.aspx)
They have enough information to get started. Sometimes if everything is enabled its a best idea to restart remote management services.

PowerShell - executing a script on a remote machine giving error

This following is not working for me -
%WINDIR%\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -Noninteractive -command "& Invoke-Command -ComputerName "Spider_LT_86" -ScriptBlock { msiexec.exe /i "D:\3PDInstallers\ETLBackgroundWorkerSetup.msi" /qn /l*vx "D:\3PDInstallers\logs" }"
all I need to do is run msiexec on a remote machine. I am assuming that the user running the script will have required access to the remote machine.
The script doesn't work even when the Computername points to the local computer (and running msiexec with the same logged in user works fine, so it doesn't look like a permissions issue) - I have ensured that the WinRM service is running, and I also disabled to firewall to check whether that is the cause of issue, but no luck so far. What am I missing here?
This is the full error but it pretty much lists all possibilities -
Connecting to remote server failed with the following error message : WinRM cannot process the request. The following error occured while using
Kerberos authentication: The network path was not found.
Possible causes are:
-The user name or password specified are invalid.
-Kerberos is used when no authentication method and no user name are specified.
-Kerberos accepts domain user names, but not local user names.
-The Service Principal Name (SPN) for the remote computer name and port does not exist.
-The client and remote computers are in different domains and there is no trust between the two domains.
After checking for the above issues, try the following:
-Check the Event Viewer for events related to authentication.
-Change the authentication method; add the destination computer to the WinRM TrustedHosts configuration setting or use HTTPS transport.
Note that computers in the TrustedHosts list might not be authenticated.
-For more information about WinRM configuration, run the following command: winrm help config. For more information, see the about_Remote_Troubleshooting He
lp topic.
+ CategoryInfo : OpenError: (:) [], PSRemotingTransportException
+ FullyQualifiedErrorId : PSSessionStateBroken
UPDATE:
When I use -Credentials with just the username, it pops up a login window to get my password and then on entering it, gives the following error - the user does have admin access so I don't know what's wrong.
The
[spider_lt_86] Connecting to remote server failed with the following error message : Access is denied. For more information, see the about_Remote_Troubleshooting Help topic.
+ CategoryInfo : OpenError: (:) [], PSRemotingTransportException
+ FullyQualifiedErrorId : PSSessionStateBroken
This is more a workaround than an answer but as you re able to use wmi why not try to create the remote process with it? Have a look here http://www.lazywinadmin.com/2011/06/powershell-launchstart-process-on.html?m=1
After comments exchange, the problem is that you had not provide a credential with administrative privilege for the remote host.
Have you set the TrustedHosts on your computer to allow you to connect to other computers?
Run this on the computer you are trying to remote from.
Set-Item wsman::localhost\client\TrustedHosts *
Restart-Service WinRm
One thing is clear, the error message "The network path was not found" gives no indication of what the underlying issue is. I saw a post in a Microsoft forum where a respondent stated it used to work and now did not. That is where I found myself. I verified that I could ping and that I could net view shares, so I knew that the network portions were functional. I rebooted the source server and that did not seem to help. Once I rebooted the target server, the WinRM error went away and everything started to work again. It is not clear whether a service was down or misbehaving or if there was something less obvious going on. After the reboot I got one more failure (out of about 20 attempts), but random failures are not so uncommon in our environment.
I will leave this behind just in case it helps someone else.