Hello Friends,
Can i some how run the below ps script by using SQL Authentication if so how would i pass the credentials for the remote server in the script?
We have servers in domains that have no trust but we can only connect thru SQL authentication.
Is there a way i can use this script by passing SQL Credentials...
foreach ($Server in (Get-Content C:\psfiles\QAEntservers.txt)){Get-WmiObject Win32_Volume -ComputerName $Server | Where {$_.DriveLetter -eq $null} | Select @{Expression={$Server};label="ServerName"},SystemName,label,@{Expression={$_.Capacity /1Gb -as [int]};Label="Total Size(GB)"},@{Expression={($_.Capacity /1Gb -as [int]) - ($_.Freespace/ 1Gb -as [int])};Label="InUse Size (GB)"},@{Expression={$_.Freespace / 1Gb -as [int]};Label="FreeSize (GB)"},@{Expression={[math]::round(((($_.Freespace /1Gb) / ($_.Capacity / 1Gb))*100),0)};Label="FreeSpace (%)"},@{Expression={$(Get-Date -format 'd')};Label="Report Date"} | Export-csv "C:\Psfiles\getqaServerspace.csv" -NoTypeInformation}
Appreciate your help!