Forgot to add this too:
$URI = "https://azlmidrange.azlifem.azl.pvt:8626/api/infrastructure/servers/update?key=$key"
My bad!
Forgot to add this too:
$URI = "https://azlmidrange.azlifem.azl.pvt:8626/api/infrastructure/servers/update?key=$key"
My bad!
So I have been working on different ways to update a server, and I am having some issues. I can create a new server, or add a new server to a role no problem with the code below. But Updating variables, I am getting this:
Invoke-RestMethod : 547160Variables_CreateOrUpdateVariable57`The INSERT statement conflicted with the FOREIGN KEY constraint "FK__Variables__Servers".
$Key= 'blahblah'
$Server = 'hdarsintsv1'
$Body =
'{
"variables": {
"Viking": "True",
},
}'
Invoke-RestMethod $URI -Method Post -Body $Body -Verbose
Any ideas? Thanks!
Is it possible to update a variable for a server based on code? For example, can I create a variable called OS and have it populate based on CIM_OperatingSystem or WMI? More specifically edit a variable on a server?
Product: Otter
Version: 2.0.13
I have a PSDsc configuration that I am having a problem with:
##AH:UseTextMode
PSDsc Registry
(
Otter_ConfigurationKey: Key,
Key : "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\1",
ValueName : "1601",
ValueType : 'Dword',
ValueData : "1"
);
PSDsc Registry
(
Otter_ConfigurationKey: Key,
Key : "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\1",
ValueName : "2100",
ValueType : 'Dword',
ValueData : "3"
);
PSDsc Registry
(
Otter_ConfigurationKey: Key,
Key : "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\3",
ValueName : "1601",
ValueType : 'Dword',
ValueData : "1"
);
PSDsc Registry
(
Otter_ConfigurationKey: Key,
Key : "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\3",
ValueName : "2100",
ValueType : 'Dword',
ValueData : "3"
);
This setting ensures IE harding of the security zones, but the trouble is two of they keys are the same, and two of the valuename or valuedata are the same as well. I have tried several combinations of trying to get the key to be more dynamic, but I can't seem to be able to work with Otter_ConfigurationKey: at all:
-Tried custom name, that doesn't work, must match a dsc property.
-tried an array like @('key','valuedata') as well as (@('key','valuedata') ), no dice there. Tried adding " " and ' ' just for kicks, no luck there.
While I love guessing, I like knowing much better. Anyone have any ideas to get this to work?
Product: Otter
Version: 2.0.12
(0x80131904): Transaction (Process ID 72) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.
Seem to be getting more of this the more servers I add. I have about 40 servers added atm. Anyone know anything about this?
Product: Otter
Version: 2.0.12
Dean, thanks for the reply. I am hoping it makes it into this release, as each server I import I have to go into the properties of each one manually and change the raft from not configured to default. While I am trying to build traction for this product, this process of touching each machine does not give a good impression. Thanks for the update!
Hello, after trying for a half hour, I was not able to get the $PSEval to successfully do any math operations for me, but something I hadn't tried in my hours of troubleshooting this is try putting the variable last and the number first, and the PSEnsure worked great at that point.
OK, so I have a simple few lines of code I want to run a server checkout on to validate memory is correct. $MEM is a server variable, and the rest is just math. Anyone else any luck doing multiplication in Otter?
I know from doing a write-output of my variables that it is not doing the low or high variables:
$MEM = 16
$Win32_ComputerSystem = Get-WmiObject -Class Win32_ComputerSystem
$ServerMEM = ($Win32_ComputerSystem.TotalPhysicalMemory / 1GB)
$Low = $MEM * 0.95
$High = $MEM * 1.05
(($ServerMEM -ge $low) -and ($ServerMEM -le $High))
Product: Otter
Version: 2.0.10
Also, I wanted to add that I tried making an entry called "Raft" and that didn't work.
"Raft": "Default",
That doesn't do anything. Any reason why this doesn't work?
I am having problems sending emails from otter. I have configured the Smtp.FromAddress, Smtp.FromName, Smtp.Host in advanced settings. I can't make this process work at all. I can send emails using powershell without issue, so it's not a firewall or email server issue; those all work fine. If I put code to send an email in a PSEnsure code block, that works fine as well, but that is definitely less than ideal. I can't get any logs or output to help my investigation, so I really don't have anything to go off of. Thanks!
Product: Otter
Version: 2.0.10
Thanks for the reply. When I am looking at a server that I have made just for exporting, it does not contain an entry for the raft, which I thought was odd:
{
"active": true,
"environments": [],
"roles": [],
"serverType": "powershell",
"credentialsName": "USERNAME",
"drift": "reportOnly",
"tempPath": "C:\\Temp",
"wsManUrl": "",
"name": "Template",
"variables": {
"DiskLabel": "%(C: OSDisk, D: DataDisk1, E: DataDisk2, F: DataDisk3, G: DataDisk4, H: DataDisk5, I: DataDisk6)"
}
},
I already had a raft configured on this template machine. but it does not show on the export. This doesn't make any sense to me why the raft would not show up as well on the configuration, IMHO. Is this a bug?
Hello, looking for a way without touching all of the servers I am importing to configure what raft to use. It does not appear this configuration is specified in either of the import. So if I am to understand this correctly, I import 100 servers and I have to 'touch' each one to configure a raft before I can do anything with them? I am sure there is a way to do this; I just am not aware of how.
Thanks!
Product: Otter
Version: 2.0.10
Hello,
I am using a PSensure to collect the information. I have a map expression configured on the server variable as to to check for disk labels:
%DiskLabel %(C: OSDisk, D: DataDisk1)
And this runs in a role to collect for each server it is assigned to:
##AH:UseTextMode
## Ensure Disk Label configuration
PSEnsure
(
Key: Disk Label Check,
Value: True,
Collect: >>
$ServerVariable = $DiskLabel
$Disks = Get-WmiObject -Class Win32_LogicalDisk -Filter "DriveType=3"
$ServerVariable.GetEnumerator() |ForEach-Object { if ( ($Disks.DeviceID).Replace(':','') -contains ("$($_.Key)")) { $y = $disks | Where-Object -Property DeviceID -match $_.Key; $y.VolumeName -eq $($_.Value) }}
>>,
Configure: >>
write-output "The fix is in"
>>
);
But when it collects, even though the values are both true, it reports as drift. Ideas?
Product: Otter
Version: 2.0.10
Thank you, that did the trick. I was using the copy path from the Ribbon in Explorer, and it already adds quotes to it. I saw in the db query that it added a ".ps1" to the end of the file name, thus creating a hiccup.
I also noticed it had the path of where I stored the PoSh script. What is the value in having the path where I uploaded it contained there? Does it truly not add the script as an object and relies on it's path in the OS where it is uploaded from? Surely this can't be true.
Any videos or recommendations for getting started with DevOps using Inedo products? We are all infrastructure people who are learning code, and are not familiar with code repositories, etc. We want to continue using code to configure our infrastructure, but would like something that all works together. Thanks!
Hello Ben, thanks for the reply. I ran the sql query against my otter db, and changed the ps1 file to the script I was trying to change. I executed the query, and it said it ran correctly. I even restarted the service, no dice. I am not able to move forward with my project until I am able to add PS scripts. I appreciate the help!
Here is the error log:
Logged:
2/22/2018 11:28:34 AM
Level:
Error
Category:
HTTP
Message:
An error occurred in the web application: Illegal characters in path.
Details:
URL: http://localhost:8626/assets
Referrer: http://localhost:8626/servers
User: Express User
User Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0) like Gecko
Stack trace: at System.IO.Path.CheckInvalidPathChars(String path, Boolean checkAdditional)
at System.IO.Path.GetFileName(String path)
at System.IO.Path.GetFileNameWithoutExtension(String path)
at Inedo.Otter.WebApplication.Pages.Assets.PowerShellScriptsOverviewPage.<>c__DisplayClass4_0.<CreateBodyContent>b__1(RaftItem p)
at System.Linq.Enumerable.WhereSelectListIterator2.MoveNext() at Inedo.Web.Controls.Element.<GetControlsFromArgument>d__41.MoveNext() at Inedo.Web.Controls.Element..ctor(String elementType, Object[] content) at Inedo.Otter.WebApplication.Pages.Assets.PowerShellScriptsOverviewPage.CreateBodyContent(Int32 raftId, IList1 items)
at Inedo.Otter.WebApplication.Pages.Administration.Rafts.RaftContentsPageBase`1.<CreateChildControlsAsync>d__20.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Inedo.Otter.WebApplication.Pages.OtterSimplePageBase.<InitializeAsync>d__1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Inedo.Web.PageFree.SimplePageBase.<ProcessRequestAsync>d__46.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Web.TaskAsyncHelper.EndTask(IAsyncResult ar)
at System.Web.HttpApplication.CallHandlerExecutionStep.OnAsyncHandlerCompletion(IAsyncResult ar)
I tried to add a PS Script as an asset, and it gave me an error about illegal characters in the path. OK, I get that, but how come it is locked in a loop and every time I try to go to the assets tab I keep getting this, even on computers I haven't tried to add anything to?
Product: Otter
Version: 2.0.5