update
This commit is contained in:
+107
@@ -0,0 +1,107 @@
|
||||
New-PSUEndpoint -Url "/Get-ITDService" -Method @('GET') -Endpoint {
|
||||
# Enter your script to process requests.
|
||||
$GetServiceParams = @{}
|
||||
If ($Name) {
|
||||
#$GetServiceParams.Name = $Name
|
||||
}
|
||||
Else {
|
||||
# Write-Error "Please add query string to Url" # moar notes
|
||||
}
|
||||
|
||||
If ($ComputerName) {
|
||||
$ComputerName = $ComputerName -split ','
|
||||
}
|
||||
Else {
|
||||
$ComputerName = $env:COMPUTERNAME
|
||||
}
|
||||
|
||||
$Services = Invoke-Command -ComputerName $ComputerName -ArgumentList $Name -ScriptBlock {
|
||||
$GetServiceParams = @{
|
||||
Name = $args[0]
|
||||
}
|
||||
Get-Service @GetServiceParams -ErrorAction SilentlyContinue
|
||||
}
|
||||
|
||||
Write-Output ($Services | select pscomputername, name, displayname, status, servicetype, @{n = 'DependentServicesName'; e = { $_.servicesdependedon.name } })
|
||||
}
|
||||
New-PSUEndpoint -Url "/Get-ITDADUser" -Method @('GET') -Endpoint {
|
||||
#If($Identity){
|
||||
# Get-ADUser -Identity $Identity -Properties LockedOut,MemberOf
|
||||
# }
|
||||
|
||||
|
||||
|
||||
Invoke-PSUScript -Script 'Get-ITDADUser_script.ps1' -Identity $Identity -Wait
|
||||
} -Authentication -Role @('ITD-PSUniversal-API-Execute')
|
||||
New-PSUEndpoint -Url "/Get-ITDADGroup" -Method @('GET') -Endpoint {
|
||||
If ($Identity) {
|
||||
Get-ADGroup -Identity $Identity
|
||||
}
|
||||
}
|
||||
New-PSUEndpoint -Url "/Get-ITDADGroupMember" -Method @('GET') -Endpoint {
|
||||
# test notes
|
||||
If ($Identity) {
|
||||
Get-ADGroupMember -Identity $Identity | select SamAccountName, Name, DistinguishedName
|
||||
}
|
||||
}
|
||||
New-PSUEndpoint -Url "/New-ITDVMwareVMSnapshot" -Method @('POST') -Endpoint {
|
||||
$User = ConvertFrom-Json $Body
|
||||
#New-User $User
|
||||
Write-Output $User
|
||||
}
|
||||
New-PSUEndpoint -Url "/zm" -Method @('GET') -Endpoint {
|
||||
$env:username
|
||||
|
||||
Connect-ITDvCenter
|
||||
Get-Datacenter
|
||||
Disconnect-VIServer -Server * -Confirm:$false
|
||||
}
|
||||
New-PSUEndpoint -Url "/Get-ITDVMwareVM" -Method @('GET') -Endpoint {
|
||||
# Enter your script to process requests.
|
||||
Connect-ITDvCenter
|
||||
|
||||
$Names = $Name -split ','
|
||||
$Result = [System.Collections.ArrayList]@()
|
||||
|
||||
$LoopOutput = ForEach ($n in $Names) {
|
||||
$VM = Get-VM -Name $n
|
||||
$VMDisks = $VM | Get-HardDisk
|
||||
$obj = [PSCustomObject]@{
|
||||
Name = $VM.Name;
|
||||
PowerState = $VM.PowerState;
|
||||
NumCpu = $VM.NumCpu;
|
||||
MemoryGB = $VM.MemoryGB;
|
||||
ProvisionedSpaceGB = ($VMDisks | Measure-Object -Sum CapacityGB).Sum
|
||||
}
|
||||
$null = $Result.Add($obj)
|
||||
}
|
||||
#>
|
||||
|
||||
Disconnect-VIServer -Server * -Confirm:$false | Out-Null
|
||||
|
||||
Write-Output $Result
|
||||
}
|
||||
New-PSUEndpoint -Url "/SyncVMwareVMtoSharePointAPI" -Method @('GET') -Endpoint {
|
||||
# Enter your script to process requests.
|
||||
Connect-ITDvCenter
|
||||
|
||||
If ($Name) {
|
||||
$VM = Get-VM -Name $Name
|
||||
$VMDisks = $VM | Get-HardDisk
|
||||
$obj = [PSCustomObject]@{
|
||||
Name = $VM.Name;
|
||||
PowerState = $VM.PowerState;
|
||||
NumCpu = $VM.NumCpu;
|
||||
MemoryGB = $VM.MemoryGB;
|
||||
ProvisionedSpaceGB = ($VMDisks | Measure-Object -Sum CapacityGB).Sum
|
||||
}
|
||||
|
||||
Write-Output "VMware:"
|
||||
Write-Output $obj
|
||||
|
||||
Sync-ITDVMwareVMMetadataToSharePoint -ComputerName $Name
|
||||
}
|
||||
#>
|
||||
|
||||
Disconnect-VIServer -Server * -Confirm:$false | Out-Null
|
||||
}
|
||||
Reference in New Issue
Block a user