mi serve una qualche indicazione su come posso procedere nella "traduzione" di questo frammento di vbscript in powershell.
Dim strSQL
strSQL = "SELECT * from tb_users where username = '" & strName & "'"
Dim strUserID
set rsMain=cnnMain.execute(strSQL)
If (rsMain.RecordCount > 0) Then
strUserID = rsMain.Fields("UserID").Value
If (Len(strUserID) > 0) Then
' tabella di tracciatura degli accessi
sQuery = "EXEC sp_UserPCLastLogin " & strUserID
Set rsMain = cnnMain.Execute(sQuery)
If (rsMain.RecordCount > 0) Then
strLastWork=CStr(rsMain.Fields("WorkStationName").Value)
strData=CStr(rsMain.Fields("DomainLogonSpawnInstant").Value)
strDay = mid(strData, 7 , 2)
strMonth= mid(strData, 5 , 2)
strYear = left(strData , 4)
strHour = mid(strData, 9 , 2)
strMin = mid(strData, 11 , 2)
End If
End If
End If